controls/DiscoveryPanel.py
branchpython3
changeset 3750 f62625418bff
parent 3717 da9ffd572551
child 3752 9f6f46dbe3ae
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
    22 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 
    26 
    27 from __future__ import absolute_import
    27 
    28 import socket
    28 import socket
    29 from six.moves import xrange
    29 from six.moves import xrange
    30 import wx
    30 import wx
    31 import wx.lib.mixins.listctrl as listmix
    31 import wx.lib.mixins.listctrl as listmix
    32 from zeroconf import ServiceBrowser, Zeroconf, get_all_addresses
    32 from zeroconf import ServiceBrowser, Zeroconf, get_all_addresses
   201 
   201 
   202     def GetURI(self):
   202     def GetURI(self):
   203         if self.LatestSelection is not None:
   203         if self.LatestSelection is not None:
   204             # if self.ByIPCheck.IsChecked():
   204             # if self.ByIPCheck.IsChecked():
   205             svcname, scheme, host, port = \
   205             svcname, scheme, host, port = \
   206                 map(lambda col: self.getColumnText(self.LatestSelection, col),
   206                 [self.getColumnText(self.LatestSelection, col) for col in range(4)]
   207                     range(4))
       
   208             return ("%s://%s:%s#%s" % (scheme, host, port, svcname)) \
   207             return ("%s://%s:%s#%s" % (scheme, host, port, svcname)) \
   209                 if scheme[-1] == "S" \
   208                 if scheme[-1] == "S" \
   210                 else ("%s://%s:%s" % (scheme, host, port))
   209                 else ("%s://%s:%s" % (scheme, host, port))
   211             # else:
   210             # else:
   212             #     svcname = self.getColumnText(self.LatestSelection, 0)
   211             #     svcname = self.getColumnText(self.LatestSelection, 0)
   221         '''
   220         '''
   222         called when a service with the desired type goes offline.
   221         called when a service with the desired type goes offline.
   223         '''
   222         '''
   224 
   223 
   225         # loop through the list items looking for the service that went offline
   224         # loop through the list items looking for the service that went offline
   226         for idx in xrange(self.ServicesList.GetItemCount()):
   225         for idx in range(self.ServicesList.GetItemCount()):
   227             # this is the unique identifier assigned to the item
   226             # this is the unique identifier assigned to the item
   228             item_id = self.ServicesList.GetItemData(idx)
   227             item_id = self.ServicesList.GetItemData(idx)
   229 
   228 
   230             # this is the full typename that was received by addService
   229             # this is the full typename that was received by addService
   231             item_name = self.itemDataMap[item_id][4]
   230             item_name = self.itemDataMap[item_id][4]