def getNameMugshot(self):
     self.myname = self.utility.session.get_nickname()
     mime, data = self.utility.session.get_mugshot()
     if data is None:
         im = IconsManager.getInstance()
         self.mugshot = im.get_default('personsMode','DEFAULT_THUMB')
     else:
         self.mugshot = data2wxBitmap(mime, data)
 def getNameMugshot(self):
     self.myname = self.utility.session.get_nickname()
     mime, data = self.utility.session.get_mugshot()
     if data is None:
         im = IconsManager.getInstance()
         self.mugshot = im.get_default('personsMode', 'DEFAULT_THUMB')
     else:
         self.mugshot = data2wxBitmap(mime, data)
Beispiel #3
0
    def __init__(self, parent, type):
        WizardPageSimple.__init__(self, parent)
        self.utility = parent.utility

        # 0. mainbox
        mainbox = wx.BoxSizer(wx.VERTICAL)

        # 1. topbox
        topbox = wx.BoxSizer(wx.VERTICAL)

        # Ask public name
        name = self.utility.session.get_nickname()

        name_box = wx.BoxSizer(wx.HORIZONTAL)
        self.myname = wx.TextCtrl(self, -1, name)
        name_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myname')),
                     0, wx.ALIGN_CENTER_VERTICAL)
        name_box.Add(self.myname, 0,
                     wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5)
        topbox.Add(name_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                   5)

        # Ask public user icon / avatar
        icon_box = wx.BoxSizer(wx.HORIZONTAL)
        icon_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myicon')),
                     0, wx.ALIGN_CENTER_VERTICAL)

        ## TODO: integrate this code with makefriends.py, especially checking code
        self.iconbtn = None
        self.iconmime, self.icondata = self.utility.session.get_mugshot()
        if self.icondata:
            bm = data2wxBitmap(self.iconmime, self.icondata)
        else:
            im = IconsManager.getInstance()
            bm = im.get_default('PEER_THUMB')

        if sys.platform == 'darwin':
            path = get_home_dir()
            self.iconbtn = wx.FilePickerCtrl(self, -1, path)
            self.Bind(wx.EVT_FILEPICKER_CHANGED,
                      self.OnIconSelected,
                      id=self.iconbtn.GetId())
            icon_box.Add(self.iconbtn, 0,
                         wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5)
        else:
            self.iconbtn = wx.BitmapButton(self, -1, bm)
            icon_box.Add(self.iconbtn, 0,
                         wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5)
            #label = wx.StaticText(self, -1, self.utility.lang.get('obligiconformat'))
            #icon_box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            self.Bind(wx.EVT_BUTTON, self.OnIconButton, self.iconbtn)

        topbox.Add(icon_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                   5)

        mainbox.Add(topbox, 0, wx.EXPAND)
        self.SetSizerAndFit(mainbox)
Beispiel #4
0
    def AddComponents(self, leftSpacer, rightSpacer):
        moderation = self.original_data

        self.header = "Discovered a moderation %s"%(format_time(moderation.inserted).lower())
        self.body = "%s reverted a modification made by %s, reason '%s'"%(moderation.peer_name, moderation.by_peer_name, moderation.message)
        
        im = IconsManager.getInstance()
        self.avantar = im.get_default('REVERTED_MODIFICATION',SMALL_ICON_MAX_DIM)
        AvantarItem.AddComponents(self, leftSpacer, rightSpacer)
Beispiel #5
0
    def AddComponents(self, leftSpacer, rightSpacer):
        marking = self.original_data

        self.header = "Discovered an opinion %s"%(format_time(marking.time_stamp).lower())
        self.body = "%s was marked as '%s'"%(marking.torrent.name, marking.type)
        
        button = wx.Button(self, -1, 'Open Torrent', style = wx.BU_EXACTFIT)
        button.Bind(wx.EVT_BUTTON, self.ShowTorrent)
        self.additionalButtons.append(button)
        
        im = IconsManager.getInstance()
        self.avantar = im.get_default('MARKING',SMALL_ICON_MAX_DIM)
        AvantarItem.AddComponents(self, leftSpacer, rightSpacer)       
Beispiel #6
0
 def AddComponents(self, leftSpacer, rightSpacer):
     torrent = self.original_data
     
     self.header = "Discovered a torrent at %s, injected at %s"%(format_time(torrent.inserted).lower(), format_time(torrent.time_stamp).lower())
     self.body = torrent.name
     
     button = wx.Button(self, -1, 'Open Torrent', style = wx.BU_EXACTFIT)
     button.Bind(wx.EVT_BUTTON, self.ShowTorrent)
     self.additionalButtons.append(button)
     
     im = IconsManager.getInstance()
     self.avantar = im.get_default('TORRENT', SMALL_ICON_MAX_DIM)
     AvantarItem.AddComponents(self, leftSpacer, rightSpacer)
Beispiel #7
0
    def avantar(self):
        im = IconsManager.getInstance()

        if self.peer_id == None:
            mime, data = self.get_mugshot()
            if data:
                data = data2wxBitmap(mime, data, SMALL_ICON_MAX_DIM)
        else:
            data = im.load_wxBitmapByPeerId(self.peer_id, SMALL_ICON_MAX_DIM)

        if data is None:
            data = im.get_default('PEER_THUMB', SMALL_ICON_MAX_DIM)
        return data
    def avantar(self):
        im = IconsManager.getInstance()
        
        if self.peer_id == None:
            mime, data = self.get_mugshot()
            if data:
                data = data2wxBitmap(mime, data, SMALL_ICON_MAX_DIM)
        else:
            data = im.load_wxBitmapByPeerId(self.peer_id, SMALL_ICON_MAX_DIM)

        if data is None:
            data = im.get_default('PEER_THUMB',SMALL_ICON_MAX_DIM)
        return data
 def _PostInit(self):
     # Do all init here
     self.backgroundColor = wx.WHITE
     self.dataBitmap = self.maskBitmap = None
     self.data = None
     self.mouseOver = False
     self.guiUtility = GUIUtility.getInstance()
     self.utility = self.guiUtility.utility
     self.Bind(wx.EVT_PAINT, self.OnPaint)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
     self.selected = False
     self.border = None
 
     self.iconsManager = IconsManager.getInstance()
    def _PostInit(self):
        # Do all init here
        self.backgroundColor = wx.WHITE
        self.dataBitmap = self.maskBitmap = None
        self.data = None
        self.mouseOver = False
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
        self.selected = False
        self.border = None

        self.iconsManager = IconsManager.getInstance()
Beispiel #11
0
    def __init__(self,parent,type):
        WizardPageSimple.__init__(self,parent)
        self.utility = parent.utility

        # 0. mainbox
        mainbox = wx.BoxSizer(wx.VERTICAL)

        # 1. topbox
        topbox = wx.BoxSizer(wx.VERTICAL)

        # Ask public name
        name = self.utility.session.get_nickname()

        name_box = wx.BoxSizer(wx.HORIZONTAL)
        self.myname = wx.TextCtrl(self, -1, name)
        name_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myname')), 0, wx.ALIGN_CENTER_VERTICAL)
        name_box.Add(self.myname, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5)
        topbox.Add(name_box, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5)

        # Ask public user icon / avatar
        icon_box = wx.BoxSizer(wx.HORIZONTAL)
        icon_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myicon')), 0, wx.ALIGN_CENTER_VERTICAL)

        ## TODO: integrate this code with makefriends.py, especially checking code
        self.iconbtn = None
        self.iconmime, self.icondata = self.utility.session.get_mugshot()
        if self.icondata:
            bm = data2wxBitmap(self.iconmime, self.icondata)
        else:
            im = IconsManager.getInstance()
            bm = im.get_default('personsMode','DEFAULT_THUMB')

        if sys.platform == 'darwin':
            path = get_home_dir()
            self.iconbtn = wx.FilePickerCtrl(self, -1, path)
            self.Bind(wx.EVT_FILEPICKER_CHANGED,self.OnIconSelected,id=self.iconbtn.GetId())
            icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5)
        else:
            self.iconbtn = wx.BitmapButton(self, -1, bm)
            icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5)
            #label = wx.StaticText(self, -1, self.utility.lang.get('obligiconformat'))
            #icon_box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            self.Bind(wx.EVT_BUTTON, self.OnIconButton, self.iconbtn)
        
        topbox.Add(icon_box, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5)


        mainbox.Add(topbox, 0, wx.EXPAND)
        self.SetSizerAndFit(mainbox)
Beispiel #12
0
 def AddComponents(self, leftSpacer, rightSpacer):
     _, comment = self.original_data
     self.header = "New comment received, posted %s by %s"%(format_time(comment.time_stamp).lower(), comment.name)
     
     if not self.inTorrent and comment.torrent:
         self.header += " in %s"%comment.torrent.name
         button = wx.Button(self, -1, 'Open Torrent', style = wx.BU_EXACTFIT)
         button.Bind(wx.EVT_BUTTON, self.ShowTorrent)
         self.additionalButtons.append(button)
         
     self.body = comment.comment
     im = IconsManager.getInstance()
     self.avantar = im.get_default('COMMENT', SMALL_ICON_MAX_DIM)
     
     AvantarItem.AddComponents(self, leftSpacer, rightSpacer)  
Beispiel #13
0
 def _PostInit(self):
     # Do all init here
     self.backgroundColor = wx.WHITE
     self.torrentBitmap = None
     self.torrent = None
     self.mouseOver = False
     self.triblerGrey = wx.Colour(128, 128, 128)
     self.triblerLightGrey = wx.Colour(203, 203, 203)
     self.sourceIcon = None
     self.guiUtility = GUIUtility.getInstance()
     self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction)
     self.Bind(wx.EVT_LEFT_UP, self.guiUtility.buttonClicked)
     self.Bind(wx.EVT_PAINT, self.OnPaint)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
     self.selected = False
     self.border = None
     self.downloading = False
     self.categoryIcon = None
     self.iconsManager = IconsManager.getInstance()
Beispiel #14
0
 def _PostInit(self):
     # Do all init here
     self.backgroundColor = wx.WHITE
     self.torrentBitmap = None
     self.torrent = None
     self.mouseOver = False
     self.triblerGrey = wx.Colour(128,128,128)
     self.triblerLightGrey = wx.Colour(203,203,203)
     self.sourceIcon = None  
     self.guiUtility = GUIUtility.getInstance()
     self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction)
     self.Bind(wx.EVT_LEFT_UP, self.guiUtility.buttonClicked)
     self.Bind(wx.EVT_PAINT, self.OnPaint)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
     self.selected = False
     self.border = None
     self.downloading = False
     self.categoryIcon = None
     self.iconsManager = IconsManager.getInstance()
 def _PostInit(self):
     # Do all init here
     self.backgroundColor = wx.WHITE
     self.dataBitmap = self.maskBitmap = None
     self.data = None
     self.mouseOver = False
     self.guiUtility = GUIUtility.getInstance()
     self.utility = self.guiUtility.utility
     self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction)
     self.Bind(wx.EVT_LEFT_UP, self.guiUtility.buttonClicked)
     self.Bind(wx.EVT_PAINT, self.OnPaint)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
     self.selected = False
     self.border = None
     #create the heart
     #I will use TasteHeart.BITMAPS to paint the right one
     self.peer_db = PeerDBHandler.getInstance()
     self.iconsManager = IconsManager.getInstance()
     self.superpeer_db = self.GetParent().parent.superpeer_db
Beispiel #16
0
    def AddComponents(self, leftSpacer, rightSpacer):
        modification = self.original_data

        if modification.name == "swift-thumbnails":
            self.guiutility = GUIUtility.getInstance()                    
            self.session    = self.guiutility.utility.session

            thumb_dir = os.path.join(self.session.get_torrent_collecting_dir(), 'thumbs-'+hexlify(modification.torrent.infohash))
            self.body = []
            if os.path.exists(thumb_dir):
                for single_thumb in os.listdir(thumb_dir)[:4]:
                    bmp = wx.Bitmap(os.path.join(thumb_dir, single_thumb), wx.BITMAP_TYPE_ANY)
                    if bmp.IsOk():
                        res = limit_resolution(bmp.GetSize(), (100, 100))
                        self.body.append(bmp.ConvertToImage().Scale(*res, quality = wx.IMAGE_QUALITY_HIGH).ConvertToBitmap())
            if not self.body:
                self.body = "WARNING: The thumbnails related to this modification could not be found on the filesystem."
        elif modification.name == "video-info":
            video_info = json.loads(modification.value)
            duration = timedelta(seconds=video_info['duration'])
            duration = str(duration).split('.')[0]
            self.body = "Modified the bitrate in '%s kb/s', the duration in '%s', and the resolution in '%dx%d'" % \
                        (video_info['bitrate'], duration, video_info['resolution'][0], video_info['resolution'][1])
        else:
            self.body = modification.value
        
        im = IconsManager.getInstance()
        if modification.moderation:
            moderation = modification.moderation
            self.header = "%s modified by %s,\nbut reverted by %s due to: '%s'"%(modification.name.capitalize(), modification.peer_name, moderation.peer_name, moderation.message)
            self.avantar = im.get_default('REVERTED_MODIFICATION',SMALL_ICON_MAX_DIM)
            self.maxlines = 2
        else:
            self.header = "%s modified by %s at %s"%(modification.name.capitalize(), modification.peer_name, format_time(modification.time_stamp).lower())
            self.avantar = im.get_default('MODIFICATION',SMALL_ICON_MAX_DIM)
        
            if not self.noButton:
                button = wx.Button(self, -1, 'Revert Modification', style = wx.BU_EXACTFIT)
                button.Bind(wx.EVT_BUTTON, self.RevertModification)
                self.additionalButtons.append(button)
        
        AvantarItem.AddComponents(self, leftSpacer, rightSpacer)
    def __init__(self, parent, keyTypedFun=None):
        global TORRENTPANEL_BACKGROUND

        wx.Panel.__init__(self, parent, -1)
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.parent = parent
        self.data = None
        self.datacopy = None
        self.titleLength = 172  # num characters
        self.selected = False
        self.warningMode = False
        self.guiserver = parent.guiserver
        self.torrentfeed = parent.torrentfeed
        self.iconsManager = IconsManager.getInstance()

        self.oldCategoryLabel = None
        self.addComponents()
        self.Show()
        self.Refresh()
        self.Layout()
 def __init__(self, parent, keyTypedFun = None):
     global TORRENTPANEL_BACKGROUND
     
     wx.Panel.__init__(self, parent, -1)
     self.guiUtility = GUIUtility.getInstance()
     self.utility = self.guiUtility.utility
     self.parent = parent
     self.data = None
     self.datacopy = None
     self.titleLength = 172 # num characters
     self.selected = False
     self.warningMode = False
     self.guiserver = parent.guiserver
     self.torrentfeed = parent.torrentfeed
     self.iconsManager = IconsManager.getInstance()
     
     self.oldCategoryLabel = None
     self.addComponents()
     self.Show()
     self.Refresh()
     self.Layout()
Beispiel #19
0
    def __init__(self, parent, keyfun):

        wx.Panel.__init__(self, parent, -1)
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.parent = parent
        self.listItem = (self.parent.cols == 1)
        self.data = None
        self.datacopy = {}
        self.titleLength = 137  # num characters
        self.triblerGrey = wx.Colour(128, 128, 128)
        self.selected = False
        self.warningMode = False
        self.oldCategoryLabel = None
        self.guiserver = parent.guiserver
        self.metadatahandler = MetadataHandler.getInstance()
        self.addComponents()
        self.iconsManager = IconsManager.getInstance()
        self.Show()
        self.Refresh()
        self.Layout()
        self.gridKeyTyped = keyfun
Beispiel #20
0
 def __init__(self, parent, keyfun):
     
     wx.Panel.__init__(self, parent, -1)
     self.guiUtility = GUIUtility.getInstance()
     self.utility = self.guiUtility.utility
     self.parent = parent
     self.listItem = (self.parent.cols == 1)
     self.data = None
     self.datacopy = {}
     self.titleLength = 137 # num characters
     self.triblerGrey = wx.Colour(128,128,128)
     self.selected = False
     self.warningMode = False
     self.oldCategoryLabel = None
     self.guiserver = parent.guiserver
     self.metadatahandler = MetadataHandler.getInstance()
     self.addComponents()
     self.iconsManager = IconsManager.getInstance()
     self.Show()
     self.Refresh()
     self.Layout()
     self.gridKeyTyped = keyfun
Beispiel #21
0
    def AddComponents(self, leftSpacer, rightSpacer):
        moderation = self.original_data

        self.header = "%s reverted a modification by %s at %s"%(moderation.peer_name.capitalize(), moderation.by_peer_name, format_time(moderation.time_stamp).lower())
        
        if moderation.modification:
            modification = moderation.modification
            self.body = "%s reverted due to '%s'.\n"%(modification.name.capitalize(),moderation.message)
            if moderation.severity > 0:
                self.body += "%s additionally issued a warning!\n"%moderation.peer_name.capitalize()
            self.body += "Modification was:\n%s"%modification.value
            
            if modification.torrent:
                self.header += " for torrent '%s'"%modification.torrent.name
                button = wx.Button(self, -1, 'Open Torrent', style = wx.BU_EXACTFIT)
                button.Bind(wx.EVT_BUTTON, self.ShowTorrent)
                self.additionalButtons.append(button)
            
        else:
            self.body = moderation.message
        im = IconsManager.getInstance()
        self.avantar = im.get_default('REVERTED_MODIFICATION',SMALL_ICON_MAX_DIM)
        
        AvantarItem.AddComponents(self, leftSpacer, rightSpacer)
Beispiel #22
0
    def __init__(self, parent, utility, download_state):
        wx.Panel.__init__(self, parent, -1)

        self.utility = utility
        self.download_state = download_state
        self.lock = Lock()

        # If the torrent is stopped, don't allow helping
        dlstopped = self.download_state is None or self.download_state.get_status() != DLSTATUS_DOWNLOADING
        dlhelper = self.download_state.get_download().get_coopdl_role() == COOPDL_ROLE_HELPER
        
        if dlstopped or dlhelper:
            if dlstopped:
                msg = self.utility.lang.get('dlhelpdisabledstop')
            elif dlhelper: 
                msg = self.utility.lang.get('dlhelpdisabledhelper')
            mainbox = wx.BoxSizer(wx.VERTICAL)
            mainbox.Add(wx.StaticText(self, -1, msg), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
            self.SetSizerAndFit(mainbox)
            return

        # 0. Read friends from DB, and figure out who's already helping 
        # for this torrent
        peer_db = self.utility.session.open_dbhandler(NTFY_PEERS)
        friends = peer_db.getGUIPeers(category_name = 'friends',
                                                                              sort = 'name', reverse = False
                                                                              )
        helpingFriends = peer_db.getPeers(self.download_state.get_coopdl_helpers(), ['permid', 'name', 'ip'])

        if DEBUG:
            print >> sys.stderr,"dlhelperframe: friends is",[a['name'] for a in friends]
            print >> sys.stderr,"dlhelperframe: helping friends is",[a['name'] for a in helpingFriends]

        # 1. Create list of images of all friends
        type = wx.LC_LIST
        #type = wx.LC_REPORT

        imgList = None
        if type != wx.LC_REPORT:
            try:
                #imgList = createImageList(self.utility,friends)
                im = IconsManager.getInstance()
                imgList = im.create_wxImageList(friends,setindex=True)
            except:
                print_exc()
                # disable icons
                type = wx.LC_REPORT

        # 2. Filter out friends already helping for left window
        self.remainingFriends = []
        for index, friend in enumerate(friends):
            
            if friend['name'] == '':
                friend['name']= 'peer %s' % show_permid_shorter(friend['permid'])
            
            flag = 0
            for helper in helpingFriends:
                if friend['permid'] == helper['permid']:
                    helper['tempiconindex'] = index
                    flag = 1
                    break
            if flag:
                continue
            #friend['tempiconindex'] = index
            self.remainingFriends.append(friend)
            

        # 3. TODO: remove entries from helpingFriends that are no longer friends

        # 4. Build GUI
        mainbox = wx.BoxSizer(wx.VERTICAL)
        topbox = wx.BoxSizer(wx.HORIZONTAL)
        botbox1 = wx.BoxSizer(wx.HORIZONTAL)
        botbox2 = wx.BoxSizer(wx.HORIZONTAL)

        # 4a. Friends in left window
        friendsbox = wx.BoxSizer(wx.VERTICAL)
        friendsbox.Add(wx.StaticText(self, -1, self.utility.lang.get('availcandidates')), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.leftListCtl = FriendList(self,self.remainingFriends,type,imgList)
        #self.leftListCtl.SetToolTipString(self.utility.lang.get('multiannouncehelp'))
        
        friendsbox.Add(self.leftListCtl, 1, wx.EXPAND|wx.TOP, 5)
        topbox.Add(friendsbox, 1, wx.EXPAND)

        # 4b. +/- buttons in between
        operatorbox = wx.BoxSizer(wx.VERTICAL)
       
        button = wx.Button(self, -1, self.utility.lang.get('requestdlhelp'), style = wx.BU_EXACTFIT)
        button.SetToolTipString(self.utility.lang.get('requestdlhelp_help'))
        wx.EVT_BUTTON(self, button.GetId(), self.add_helper)
        operatorbox.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3)

        button2 = wx.Button(self, -1, self.utility.lang.get('stopdlhelp'), style = wx.BU_EXACTFIT)
        button2.SetToolTipString(self.utility.lang.get('stopdlhelp_help'))
        wx.EVT_BUTTON(self, button2.GetId(), self.remove_helper)
        operatorbox.Add(button2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3)

        topbox.Add(operatorbox, 0, wx.ALIGN_CENTER_VERTICAL)

        # 4c. Selected helpers in right window
        helperbox = wx.BoxSizer(wx.VERTICAL)
        helperbox.Add(wx.StaticText(self, -1, self.utility.lang.get('helpers')), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
       
        self.rightListCtl = FriendList(self,helpingFriends,type,imgList)
        #self.rightListCtl.SetToolTipString(self.utility.lang.get('httpseedshelp'))
        helperbox.Add(self.rightListCtl, 1, wx.EXPAND|wx.ALL, 5)
        topbox.Add(helperbox, 1, wx.EXPAND)      

        # Keep helpers up-to-date
        #self.timer = wx.Timer(self)
        #self.Bind(wx.EVT_TIMER, self.OnTimer)
        #self.timer.Start(4000)
        self.init_download_state_update()

        howtotext1 = wx.StaticText(self, -1, self.utility.lang.get('dlhelphowto1'))
        howtotext1.Wrap(500)
        botbox1.Add(howtotext1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5)
        
        howtotext2 = wx.StaticText(self, -1, self.utility.lang.get('dlhelphowto2'))
        howtotext2.Wrap(500)
        botbox2.Add(howtotext2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5)


        # 5. Show GUI
        mainbox.Add(botbox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)        
        mainbox.Add(topbox, 0, wx.EXPAND|wx.ALL)
        mainbox.Add(botbox2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)        
        
        #self.SetSizerAndFit(mainbox)
        self.SetSizer(mainbox)
        self.SetAutoLayout(True)
Beispiel #23
0
    def _PostInit(self):
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.defaultDLConfig = DefaultDownloadStartupConfig.getInstance()

        dialog = xrc.XRCCTRL(self, "settingsDialog")
        for element in self.elementsName:
            xrcElement = xrc.XRCCTRL(dialog, element)
            if not xrcElement:
                print "settingsOverviewPanel: Error: Could not identify xrc element:", element
            self.elements[element] = xrcElement

        # Building tree
        self.tree = xrc.XRCCTRL(self, "settings_tree")
        root = self.tree.AddRoot("Root")
        self.tree.SelectItem(
            self.tree.AppendItem(root, "General", data=wx.TreeItemData(xrc.XRCCTRL(self, "general_panel"))), True
        )
        self.tree.AppendItem(root, "Connection", data=wx.TreeItemData(xrc.XRCCTRL(self, "connection_panel")))
        self.tree.AppendItem(root, "Limits", data=wx.TreeItemData(xrc.XRCCTRL(self, "bandwidth_panel")))
        self.tree.AppendItem(root, "Seeding", data=wx.TreeItemData(xrc.XRCCTRL(self, "seeding_panel")))
        self.tree.AppendItem(root, "Experimental", data=wx.TreeItemData(xrc.XRCCTRL(self, "exp_panel")))
        self.tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging)

        # Bind event listeners
        self.elements["zeroUp"].Bind(wx.EVT_BUTTON, lambda event: self.setUp(0, event))
        self.elements["fiftyUp"].Bind(wx.EVT_BUTTON, lambda event: self.setUp(50, event))
        self.elements["hundredUp"].Bind(wx.EVT_BUTTON, lambda event: self.setUp(100, event))
        self.elements["unlimitedUp"].Bind(wx.EVT_BUTTON, lambda event: self.setUp("unlimited", event))

        self.elements["seventyfiveDown"].Bind(wx.EVT_BUTTON, lambda event: self.setDown(75, event))
        self.elements["threehundredDown"].Bind(wx.EVT_BUTTON, lambda event: self.setDown(300, event))
        self.elements["sixhundreddDown"].Bind(wx.EVT_BUTTON, lambda event: self.setDown(600, event))
        self.elements["unlimitedDown"].Bind(wx.EVT_BUTTON, lambda event: self.setDown("unlimited", event))

        self.elements["uploadCtrl"].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        self.elements["downloadCtrl"].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)

        self.elements["edit"].Bind(wx.EVT_BUTTON, self.EditClicked)
        self.elements["browse"].Bind(wx.EVT_BUTTON, self.BrowseClicked)

        self.Bind(wx.EVT_BUTTON, self.saveAll, id=xrc.XRCID("wxID_OK"))
        self.Bind(wx.EVT_BUTTON, self.cancelAll, id=xrc.XRCID("wxID_CANCEL"))

        # Loading settings
        self.myname = self.utility.session.get_nickname()
        mime, data = self.utility.session.get_mugshot()
        if data is None:
            im = IconsManager.getInstance()
            self.mugshot = im.get_default("PEER_THUMB")
        else:
            self.mugshot = data2wxBitmap(mime, data)

        self.elements["myNameField"].SetValue(self.myname)
        self.elements["thumb"].SetBitmap(self.mugshot)

        if self.guiUtility.frame.SRstatusbar.IsReachable():
            self.elements["firewallStatusText"].SetLabel("Your network connection is working properly.")
        else:
            self.elements["firewallStatusText"].SetLabel(
                "Tribler has not yet received any incoming connections. \nThis could indicate a problem with your network connection."
            )

        self.currentPortValue = str(self.utility.session.get_listen_port())
        self.elements["firewallValue"].SetValue(self.currentPortValue)

        self.elements["downloadCtrl"].SetValue(self.utility.getMaxDown())
        self.elements["uploadCtrl"].SetValue(self.utility.getMaxUp())

        self.currentDestDir = self.defaultDLConfig.get_dest_dir()
        self.elements["diskLocationCtrl"].SetValue(self.currentDestDir)
        self.elements["diskLocationChoice"].SetValue(self.defaultDLConfig.get_show_saveas())

        if sys.platform != "darwin":
            min_to_tray = self.utility.config.Read("mintray", "int") == 1
            self.elements["minimize_to_tray"].SetValue(min_to_tray)
        else:
            self.elements["minimize_to_tray"].Enable(False)

        self.elements["t4t0"].SetLabel(self.utility.lang.get("no_leeching"))
        self.elements["t4t0"].Refresh()
        self.elements["t4t1"].SetLabel(self.utility.lang.get("unlimited_seeding"))
        self.elements["t4t2"].SetLabel(self.utility.lang.get("seed_sometime"))
        self.elements["t4t3"].SetLabel(self.utility.lang.get("no_seeding"))

        self.elements["g2g0"].SetLabel(self.utility.lang.get("seed_for_large_ratio"))
        self.elements["g2g1"].SetLabel(self.utility.lang.get("boost__reputation"))
        self.elements["g2g2"].SetLabel(self.utility.lang.get("seed_sometime"))
        self.elements["g2g3"].SetLabel(self.utility.lang.get("no_seeding"))

        t4t_option = self.utility.config.Read("t4t_option", "int")
        self.elements["t4t%d" % t4t_option].SetValue(True)
        t4t_ratio = self.utility.config.Read("t4t_ratio", "int") / 100.0
        index = self.elements["t4t0choice"].FindString(str(t4t_ratio))
        if index != wx.NOT_FOUND:
            self.elements["t4t0choice"].Select(index)

        t4t_hours = self.utility.config.Read("t4t_hours", "int")
        t4t_minutes = self.utility.config.Read("t4t_mins", "int")
        self.elements["t4t2text"].SetLabel("%d:%d" % (t4t_hours, t4t_minutes))

        g2g_option = self.utility.config.Read("g2g_option", "int")
        self.elements["g2g%d" % g2g_option].SetValue(True)
        g2g_ratio = self.utility.config.Read("g2g_ratio", "int") / 100.0
        index = self.elements["g2g0choice"].FindString(str(g2g_ratio))
        if index != wx.NOT_FOUND:
            self.elements["g2g0choice"].Select(index)

        g2g_hours = self.utility.config.Read("g2g_hours", "int")
        g2g_mins = self.utility.config.Read("g2g_mins", "int")
        self.elements["g2g2text"].SetLabel("%d:%d" % (g2g_hours, g2g_mins))

        self.elements["use_webui"].SetValue(self.utility.config.Read("use_webui", "boolean"))
        self.elements["webui_port"].SetValue(str(self.utility.config.Read("webui_port", "int")))

        wx.CallAfter(self.Refresh)
Beispiel #24
0
    def _PostInit(self):
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.defaultDLConfig = DefaultDownloadStartupConfig.getInstance()

        dialog = xrc.XRCCTRL(self, "settingsDialog")
        for element in self.elementsName:
            xrcElement = xrc.XRCCTRL(dialog, element)
            if not xrcElement:
                print 'settingsOverviewPanel: Error: Could not identify xrc element:',element
            self.elements[element] = xrcElement
        
        #Building tree
        self.tree = xrc.XRCCTRL(self,"settings_tree")
        root = self.tree.AddRoot('Root')
        self.tree.SelectItem(self.tree.AppendItem(root,'General',data=wx.TreeItemData(xrc.XRCCTRL(self,"general_panel"))),True)
        self.tree.AppendItem(root,'Connection',data=wx.TreeItemData(xrc.XRCCTRL(self,"connection_panel")))
        self.tree.AppendItem(root,'Bandwidth',data=wx.TreeItemData(xrc.XRCCTRL(self,"bandwidth_panel")))
        self.tree.AppendItem(root,'Misc',data=wx.TreeItemData(xrc.XRCCTRL(self,"misc_panel")))
        self.tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging)

        #Bind event listeners
        self.elements['diskLocationChoice'].Bind(wx.EVT_CHECKBOX, self.OnDownloadChoice)
        
        self.elements['zeroUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(0, event))
        self.elements['fiftyUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(50, event))
        self.elements['hundredUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(100, event))
        self.elements['unlimitedUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp('unlimited', event))

        self.elements['seventyfiveDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(75, event))
        self.elements['threehundredDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(300, event))
        self.elements['sixhundreddDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(600, event))
        self.elements['unlimitedDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown('unlimited', event))

        self.elements['uploadCtrl'].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        self.elements['downloadCtrl'].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        
        self.elements['edit'].Bind(wx.EVT_BUTTON, self.EditClicked)
        self.elements['browse'].Bind(wx.EVT_BUTTON, self.BrowseClicked)
        
        self.elements['batchstart'].Bind(wx.EVT_BUTTON, lambda event: self.OnMultiple(True))
        self.elements['batchstop'].Bind(wx.EVT_BUTTON, lambda event: self.OnMultiple(False))
        
        self.Bind(wx.EVT_BUTTON, self.saveAll, id = xrc.XRCID("wxID_OK"))
        self.Bind(wx.EVT_BUTTON, self.cancelAll, id = xrc.XRCID("wxID_CANCEL"))
        
        #Loading settings
        self.myname = self.utility.session.get_nickname()
        mime, data = self.utility.session.get_mugshot()
        if data is None:
            im = IconsManager.getInstance()
            self.mugshot = im.get_default('personsMode','DEFAULT_THUMB')
        else:
            self.mugshot = data2wxBitmap(mime, data)
        
        self.elements['myNameField'].SetValue(self.myname)
        self.elements['thumb'].setBitmap(self.mugshot)
        
        if self.guiUtility.frame.SRstatusbar.IsReachable():
            self.elements['firewallStatus'].setSelected(2)
            self.elements['firewallStatusText'].SetLabel('Port is working')
        
        if self.utility.config.Read('family_filter', "boolean"):
            self.elements['familyFilter'].SetSelection(0)
        else:
            self.elements['familyFilter'].SetSelection(1)

        self.currentPopup = self.utility.config.Read('popup_player', "boolean")
        if self.currentPopup:
            self.elements['externalplayer'].SetSelection(1)
        else:
            self.elements['externalplayer'].SetSelection(0)
        
        self.currentPortValue = str(self.guiUtility.get_port_number())
        self.elements['firewallValue'].SetValue(self.currentPortValue)
        
        maxdownloadrate = self.utility.config.Read('maxdownloadrate', 'int')
        if maxdownloadrate == 0:
            self.elements['downloadCtrl'].SetValue('unlimited')        
        else:
            self.elements['downloadCtrl'].SetValue(str(maxdownloadrate))
        
        maxuploadrate = self.utility.config.Read('maxuploadrate', 'int')
        if maxuploadrate == -1:
            self.elements['uploadCtrl'].SetValue('0')        
        elif maxuploadrate == 0:
            self.elements['uploadCtrl'].SetValue('unlimited')        
        else:
            self.elements['uploadCtrl'].SetValue(str(maxuploadrate))
        
        self.currentDestDir = self.defaultDLConfig.get_dest_dir()
        self.elements['diskLocationCtrl'].SetValue(self.currentDestDir)
        self.elements['diskLocationCtrl'].Enable(not self.defaultDLConfig.get_show_saveas())
        self.elements['diskLocationChoice'].SetValue(self.defaultDLConfig.get_show_saveas())
        
        self.elements['use_bundle_magic'].SetValue(self.utility.config.Read('use_bundle_magic', "boolean"))
        
        wx.CallAfter(self.Refresh)
    def _PostInit(self):
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.defaultDLConfig = DefaultDownloadStartupConfig.getInstance()

        dialog = xrc.XRCCTRL(self, "settingsDialog")
        for element in self.elementsName:
            xrcElement = xrc.XRCCTRL(dialog, element)
            if not xrcElement:    
                print 'settingsOverviewPanel: Error: Could not identify xrc element:',element
            self.elements[element] = xrcElement
        
        #Building tree
        self.tree = xrc.XRCCTRL(self,"settings_tree")
        root = self.tree.AddRoot('Root')
        self.tree.SelectItem(self.tree.AppendItem(root,'General',data=wx.TreeItemData(xrc.XRCCTRL(self,"general_panel"))),True)
        self.tree.AppendItem(root,'Connection',data=wx.TreeItemData(xrc.XRCCTRL(self,"connection_panel")))
        self.tree.AppendItem(root,'Limits',data=wx.TreeItemData(xrc.XRCCTRL(self,"bandwidth_panel")))
        self.tree.AppendItem(root,'Seeding',data=wx.TreeItemData(xrc.XRCCTRL(self,"seeding_panel")))
        self.tree.AppendItem(root,'Misc',data=wx.TreeItemData(xrc.XRCCTRL(self,"misc_panel")))
        self.tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging)

        #Bind event listeners
        self.elements['zeroUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(0, event))
        self.elements['fiftyUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(50, event))
        self.elements['hundredUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp(100, event))
        self.elements['unlimitedUp'].Bind(wx.EVT_BUTTON, lambda event: self.setUp('unlimited', event))

        self.elements['seventyfiveDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(75, event))
        self.elements['threehundredDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(300, event))
        self.elements['sixhundreddDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown(600, event))
        self.elements['unlimitedDown'].Bind(wx.EVT_BUTTON, lambda event: self.setDown('unlimited', event))

        self.elements['uploadCtrl'].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        self.elements['downloadCtrl'].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        
        self.elements['edit'].Bind(wx.EVT_BUTTON, self.EditClicked)
        self.elements['browse'].Bind(wx.EVT_BUTTON, self.BrowseClicked)
        
        self.elements['batchstart'].Bind(wx.EVT_BUTTON, lambda event: self.OnMultiple(True))
        self.elements['batchstop'].Bind(wx.EVT_BUTTON, lambda event: self.OnMultiple(False))
        self.elements['batchmove'].Bind(wx.EVT_BUTTON, self.OnMultipleMove)
        
        self.Bind(wx.EVT_BUTTON, self.saveAll, id = xrc.XRCID("wxID_OK"))
        self.Bind(wx.EVT_BUTTON, self.cancelAll, id = xrc.XRCID("wxID_CANCEL"))
        
        #Loading settings
        self.myname = self.utility.session.get_nickname()
        mime, data = self.utility.session.get_mugshot()
        if data is None:
            im = IconsManager.getInstance()
            self.mugshot = im.get_default('PEER_THUMB')
        else:
            self.mugshot = data2wxBitmap(mime, data)
        
        self.elements['myNameField'].SetValue(self.myname)
        self.elements['thumb'].setBitmap(self.mugshot)
        
        if self.guiUtility.frame.SRstatusbar.IsReachable():
            self.elements['firewallStatus'].setSelected(2)
            self.elements['firewallStatusText'].SetLabel('Port is working')
        
        if self.utility.config.Read('family_filter', "boolean"):
            self.elements['familyFilter'].SetSelection(0)
        else:
            self.elements['familyFilter'].SetSelection(1)

        self.currentPopup = self.utility.config.Read('popup_player', "boolean")
        if self.currentPopup:
            self.elements['externalplayer'].SetSelection(1)
        else:
            self.elements['externalplayer'].SetSelection(0)
        
        self.currentPortValue = str(self.guiUtility.get_port_number())
        self.elements['firewallValue'].SetValue(self.currentPortValue)
        
        maxdownloadrate = self.utility.config.Read('maxdownloadrate', 'int')
        if maxdownloadrate == 0:
            self.elements['downloadCtrl'].SetValue('unlimited')        
        else:
            self.elements['downloadCtrl'].SetValue(str(maxdownloadrate))
        
        maxuploadrate = self.utility.config.Read('maxuploadrate', 'int')
        if maxuploadrate == -1:
            self.elements['uploadCtrl'].SetValue('0')        
        elif maxuploadrate == 0:
            self.elements['uploadCtrl'].SetValue('unlimited')        
        else:
            self.elements['uploadCtrl'].SetValue(str(maxuploadrate))
        
        self.currentDestDir = self.defaultDLConfig.get_dest_dir()
        self.elements['diskLocationCtrl'].SetValue(self.currentDestDir)
        self.elements['diskLocationChoice'].SetValue(self.defaultDLConfig.get_show_saveas())
        
        self.elements['use_bundle_magic'].SetValue(self.utility.config.Read('use_bundle_magic', "boolean"))
        
        self.elements['t4t0'].SetLabel(self.utility.lang.get('no_leeching'))
        self.elements['t4t1'].SetLabel(self.utility.lang.get('unlimited_seeding'))
        self.elements['t4t2'].SetLabel(self.utility.lang.get('seed_sometime'))
        self.elements['t4t3'].SetLabel(self.utility.lang.get('no_seeding'))
        
        self.elements['g2g0'].SetLabel(self.utility.lang.get('seed_for_large_ratio'))
        self.elements['g2g1'].SetLabel(self.utility.lang.get('boost__reputation'))
        self.elements['g2g2'].SetLabel(self.utility.lang.get('seed_sometime'))
        self.elements['g2g3'].SetLabel(self.utility.lang.get('no_seeding'))
        
        
        t4t_option = self.utility.config.Read('t4t_option', 'int')
        self.elements['t4t%d'%t4t_option].SetValue(True)
        t4t_ratio = self.utility.config.Read('t4t_ratio', 'int')/100.0
        index = self.elements['t4t0choice'].FindString(str(t4t_ratio))
        if index != wx.NOT_FOUND:
            self.elements['t4t0choice'].Select(index)
        
        t4t_hours = self.utility.config.Read('t4t_hours', 'int') 
        t4t_minutes = self.utility.config.Read('t4t_mins', 'int')
        self.elements['t4t2text'].SetLabel("%d:%d"%(t4t_hours, t4t_minutes))
        
        g2g_option = self.utility.config.Read('g2g_option', 'int')
        self.elements['g2g%d'%g2g_option].SetValue(True)
        g2g_ratio = self.utility.config.Read('g2g_ratio', 'int')/100.0
        index = self.elements['g2g0choice'].FindString(str(g2g_ratio))
        if index != wx.NOT_FOUND:
            self.elements['g2g0choice'].Select(index)

        g2g_hours = self.utility.config.Read('g2g_hours', 'int') 
        g2g_mins = self.utility.config.Read('g2g_mins', 'int')
        self.elements['g2g2text'].SetLabel("%d:%d"%(g2g_hours, g2g_mins))
        wx.CallAfter(self.Refresh)
Beispiel #26
0
    def _PostInit(self):
        self.guiUtility = GUIUtility.getInstance()
        self.utility = self.guiUtility.utility
        self.defaultDLConfig = DefaultDownloadStartupConfig.getInstance()

        dialog = xrc.XRCCTRL(self, "settingsDialog")
        for element in self.elementsName:
            xrcElement = xrc.XRCCTRL(dialog, element)
            if not xrcElement:
                print 'settingsOverviewPanel: Error: Could not identify xrc element:', element
            self.elements[element] = xrcElement

        #Building tree
        self.tree = xrc.XRCCTRL(self, "settings_tree")
        root = self.tree.AddRoot('Root')
        self.tree.SelectItem(
            self.tree.AppendItem(root,
                                 'General',
                                 data=wx.TreeItemData(
                                     xrc.XRCCTRL(self, "general_panel"))),
            True)
        self.tree.AppendItem(root,
                             'Connection',
                             data=wx.TreeItemData(
                                 xrc.XRCCTRL(self, "connection_panel")))
        self.tree.AppendItem(root,
                             'Limits',
                             data=wx.TreeItemData(
                                 xrc.XRCCTRL(self, "bandwidth_panel")))
        self.tree.AppendItem(root,
                             'Seeding',
                             data=wx.TreeItemData(
                                 xrc.XRCCTRL(self, "seeding_panel")))
        self.tree.AppendItem(root,
                             'Experimental',
                             data=wx.TreeItemData(
                                 xrc.XRCCTRL(self, "exp_panel")))
        self.tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging)

        #Bind event listeners
        self.elements['zeroUp'].Bind(wx.EVT_BUTTON,
                                     lambda event: self.setUp(0, event))
        self.elements['fiftyUp'].Bind(wx.EVT_BUTTON,
                                      lambda event: self.setUp(50, event))
        self.elements['hundredUp'].Bind(wx.EVT_BUTTON,
                                        lambda event: self.setUp(100, event))
        self.elements['unlimitedUp'].Bind(
            wx.EVT_BUTTON, lambda event: self.setUp('unlimited', event))

        self.elements['seventyfiveDown'].Bind(
            wx.EVT_BUTTON, lambda event: self.setDown(75, event))
        self.elements['threehundredDown'].Bind(
            wx.EVT_BUTTON, lambda event: self.setDown(300, event))
        self.elements['sixhundreddDown'].Bind(
            wx.EVT_BUTTON, lambda event: self.setDown(600, event))
        self.elements['unlimitedDown'].Bind(
            wx.EVT_BUTTON, lambda event: self.setDown('unlimited', event))

        self.elements['uploadCtrl'].Bind(wx.EVT_KEY_DOWN, self.removeUnlimited)
        self.elements['downloadCtrl'].Bind(wx.EVT_KEY_DOWN,
                                           self.removeUnlimited)

        self.elements['edit'].Bind(wx.EVT_BUTTON, self.EditClicked)
        self.elements['browse'].Bind(wx.EVT_BUTTON, self.BrowseClicked)

        self.Bind(wx.EVT_BUTTON, self.saveAll, id=xrc.XRCID("wxID_OK"))
        self.Bind(wx.EVT_BUTTON, self.cancelAll, id=xrc.XRCID("wxID_CANCEL"))

        #Loading settings
        self.myname = self.utility.session.get_nickname()
        mime, data = self.utility.session.get_mugshot()
        if data is None:
            im = IconsManager.getInstance()
            self.mugshot = im.get_default('PEER_THUMB')
        else:
            self.mugshot = data2wxBitmap(mime, data)

        self.elements['myNameField'].SetValue(self.myname)
        self.elements['thumb'].setBitmap(self.mugshot)

        if self.guiUtility.frame.SRstatusbar.IsReachable():
            self.elements['firewallStatus'].setSelected(2)
            self.elements['firewallStatusText'].SetLabel('Port is working')

        self.currentPortValue = str(self.guiUtility.get_port_number())
        self.elements['firewallValue'].SetValue(self.currentPortValue)

        self.elements['downloadCtrl'].SetValue(self.utility.getMaxDown())
        self.elements['uploadCtrl'].SetValue(self.utility.getMaxUp())

        self.currentDestDir = self.defaultDLConfig.get_dest_dir()
        self.elements['diskLocationCtrl'].SetValue(self.currentDestDir)
        self.elements['diskLocationChoice'].SetValue(
            self.defaultDLConfig.get_show_saveas())

        if sys.platform != "darwin":
            min_to_tray = self.utility.config.Read('mintray', "int") == 1
            self.elements['minimize_to_tray'].SetValue(min_to_tray)
        else:
            self.elements['minimize_to_tray'].Enable(False)

        self.elements['t4t0'].SetLabel(self.utility.lang.get('no_leeching'))
        self.elements['t4t0'].Refresh()
        self.elements['t4t1'].SetLabel(
            self.utility.lang.get('unlimited_seeding'))
        self.elements['t4t2'].SetLabel(self.utility.lang.get('seed_sometime'))
        self.elements['t4t3'].SetLabel(self.utility.lang.get('no_seeding'))

        self.elements['g2g0'].SetLabel(
            self.utility.lang.get('seed_for_large_ratio'))
        self.elements['g2g1'].SetLabel(
            self.utility.lang.get('boost__reputation'))
        self.elements['g2g2'].SetLabel(self.utility.lang.get('seed_sometime'))
        self.elements['g2g3'].SetLabel(self.utility.lang.get('no_seeding'))

        t4t_option = self.utility.config.Read('t4t_option', 'int')
        self.elements['t4t%d' % t4t_option].SetValue(True)
        t4t_ratio = self.utility.config.Read('t4t_ratio', 'int') / 100.0
        index = self.elements['t4t0choice'].FindString(str(t4t_ratio))
        if index != wx.NOT_FOUND:
            self.elements['t4t0choice'].Select(index)

        t4t_hours = self.utility.config.Read('t4t_hours', 'int')
        t4t_minutes = self.utility.config.Read('t4t_mins', 'int')
        self.elements['t4t2text'].SetLabel("%d:%d" % (t4t_hours, t4t_minutes))

        g2g_option = self.utility.config.Read('g2g_option', 'int')
        self.elements['g2g%d' % g2g_option].SetValue(True)
        g2g_ratio = self.utility.config.Read('g2g_ratio', 'int') / 100.0
        index = self.elements['g2g0choice'].FindString(str(g2g_ratio))
        if index != wx.NOT_FOUND:
            self.elements['g2g0choice'].Select(index)

        g2g_hours = self.utility.config.Read('g2g_hours', 'int')
        g2g_mins = self.utility.config.Read('g2g_mins', 'int')
        self.elements['g2g2text'].SetLabel("%d:%d" % (g2g_hours, g2g_mins))

        self.elements['use_webui'].SetValue(
            self.utility.config.Read('use_webui', "boolean"))
        self.elements['webui_port'].SetValue(
            str(self.utility.config.Read('webui_port', "int")))

        wx.CallAfter(self.Refresh)