Пример #1
0
 def _PostInit(self):
     if DEBUG:
         print >> sys.stderr, "TopSearchPanel: OnCreate"
     
     bgPanel._PostInit(self)
     self.SetBackgroundColour(wx.Colour(255, 255, 255))
     
     if sys.platform == 'darwin':
         self.searchField = wx.SearchCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER)
         self.searchField.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearchKeyDown)
     else:
         self.searchField = TextCtrlAutoComplete(self, entrycallback = self.complete, selectcallback = self.OnAutoComplete)
     self.searchField.SetMinSize((400, -1))
     self.searchField.Bind(wx.EVT_TEXT_ENTER, self.OnSearchKeyDown)
     
     self.go = tribler_topButton(self,-1,name = 'Search_new')
     self.go.SetMinSize((50, 24))
     self.go.Bind(wx.EVT_LEFT_UP, self.OnSearchKeyDown)
     
     def createToggle(label, event):
         button = wx.ToggleButton(self, -1, label)
         button.Bind(wx.EVT_TOGGLEBUTTON, event)
         return button
     
     self.channels = createToggle('Channels', self.OnChannels)
     self.settings = createToggle('Settings', self.OnSettings)
     self.my_files = createToggle('Library', self.OnLibrary)
     self.results = createToggle('Results', self.OnResults)
     self.results.Disable()
     
     self.home = createToggle('Home', self.OnHome)
     
     if sys.platform == 'win32':
         self.files_friends = wx.StaticBitmap(self, -1, self.Bitmap("images/search_files_channels.png", wx.BITMAP_TYPE_ANY))
         self.tribler_logo2 = wx.StaticBitmap(self, -1, self.Bitmap("images/logo4video2_win.png", wx.BITMAP_TYPE_ANY))
     else:    
         self.files_friends = wx.StaticText(self, -1, "Search Files or Channels") 
         self.tribler_logo2 = wx.StaticBitmap(self, -1, self.Bitmap("images/logo4video2.png", wx.BITMAP_TYPE_ANY))
         
         if sys.platform == 'linux2':
             self.files_friends.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, 0, "Nimbus Sans L"))
         elif sys.platform == 'darwin': # mac
             self.files_friends.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, 0, ""))
     self.tribler_logo2.Bind(wx.EVT_LEFT_UP, self.OnStats)
     
     self.__do_layout()
     self.Layout()
     
     self.selectTab('home')
     
     self.init_ready = True
     self.Bind(wx.EVT_SIZE, self.OnResize)
    def addComponents(self):
        self.Show(False)
        #self.SetMinSize((50,50))
        self.selectedColour = wx.Colour(255,200,187)       
        self.unselectedColour = wx.WHITE
        
        self.SetBackgroundColour(self.unselectedColour)
        self.hSizer = wx.BoxSizer(wx.HORIZONTAL)
        
        self.Bind(wx.EVT_LEFT_UP, self.mouseAction)
        self.Bind(wx.EVT_KEY_UP, self.keyTyped)
        
        # Add Spacer
        self.hSizer.Add([8,22],0,wx.EXPAND|wx.FIXED_MINSIZE,0)  
              
        # Add Checkbox turn on/off
        self.cB = wx.CheckBox(self,-1,"",wx.Point(8,128),wx.Size(18,18))        
        self.cB.SetForegroundColour(wx.Colour(0,0,0))
        self.hSizer.Add(self.cB, 0, wx.TOP|wx.LEFT|wx.RIGHT, 3)        
        
        # Add Spacer
        self.hSizer.Add([0,20],0,wx.EXPAND|wx.FIXED_MINSIZE,0)        
        
        # Add thumb / favicon from website?
        self.thumb = FavicoThumbnailViewer(self)
        self.thumb.setBackground(wx.BLACK)
        self.thumb.SetSize((16,16))
        self.hSizer.Add(self.thumb, 0, wx.TOP|wx.RIGHT, 3)        
        
        # Add title                
        self.title =wx.StaticText(self,-1,"Tribler discovery through other Tribler Users",wx.Point(0,0),wx.Size(800,20))                
        #self.title.SetBackgroundColour(wx.BLUE)        
        self.title.SetFont(wx.Font(FS_SUBSCRTITLE,FONTFAMILY,FONTWEIGHT,wx.NORMAL,False,FONTFACE))
        self.title.SetMinSize((550,20))
        self.hSizer.Add(self.title, 1, wx.TOP|wx.RIGHT, 5)     
        
        # Add title        
        #self.today =wx.StaticText(self,-1,"today: 10 files",wx.Point(0,0),wx.Size(140,18))        
        #self.today.SetBackgroundColour(wx.WHITE)
        #self.today.SetFont(wx.Font(10,FONTFAMILY,FONTWEIGHT,wx.NORMAL,False,FONTFACE))
        #self.today.SetMinSize((140,18))
        #self.hSizer.Add(self.today, 0, wx.BOTTOM|wx.TOP|wx.RIGHT, 3)
        
        # Add left vertical line
#        self.vLine1 = self.addLine()
        
        """
        # Add total number of received files
        self.totalnumber =wx.StaticText(self,-1,"",wx.Point(0,0),wx.Size(130,12))        
        self.totalnumber.SetBackgroundColour(wx.WHITE)
        self.totalnumber.SetFont(wx.Font(FS_TOTALNUMBER,FONTFAMILY,FONTWEIGHT,wx.NORMAL,False,FONTFACE))
        self.totalnumber.SetForegroundColour(wx.Colour(128,128,128))        
        self.totalnumber.SetMinSize((60,12))
        self.totalnumber.SetLabel('') 
        self.hSizer.Add(self.totalnumber,0,wx.TOP|wx.EXPAND,3)
        
        # Add left vertical line
        self.vLine2 = self.addLine()
        """         
        
        # Add Spacer to keep space occupied when no delete button is available
        self.vSizer = wx.BoxSizer(wx.VERTICAL)                
        self.vSizer.Add([20,1],0,wx.FIXED_MINSIZE,0)          
        
        # Add delete button
        self.delete = tribler_topButton(self, -1, wx.Point(0,0), wx.Size(16,16),name='deleteSubscriptionItem')                
        self.vSizer.Add(self.delete, 0, wx.TOP, 3)        
        
        self.hSizer.Add(self.vSizer, 0, wx.LEFT|wx.RIGHT|wx.TOP, 0)
        
        
        # Add Spacer
        self.hSizer.Add([8,20],0,wx.EXPAND|wx.FIXED_MINSIZE,0)        

        self.SetSizer(self.hSizer);
        self.SetAutoLayout(1);
        self.Layout();
        self.Refresh()

        self.Bind(wx.EVT_CHECKBOX, self.checkboxAction, self.cB)
        
        # 2.8.4.2 return value of GetChildren changed
        wl = []
        for c in self.GetChildren():
            wl.append(c)
        for window in wl:
            window.Bind(wx.EVT_LEFT_UP, self.mouseAction)
            window.Bind(wx.EVT_KEY_UP, self.keyTyped)
            window.Bind(wx.EVT_RIGHT_DOWN, self.mouseAction) 
Пример #3
0
 def _PostInit(self):
     self.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
     self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
     
     if DEBUG:
         print >> sys.stderr, "TopSearchPanel: OnCreate"
     
     if sys.platform == 'darwin':
         self.searchField = wx.SearchCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER)
         self.searchField.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearchKeyDown)
     else:
         self.searchField = TextCtrlAutoComplete(self, entrycallback = self.complete, selectcallback = self.OnAutoComplete)
     self.searchField.SetMinSize((400, -1))
     self.searchField.Bind(wx.EVT_TEXT_ENTER, self.OnSearchKeyDown)
     
     self.go = tribler_topButton(self,-1,name = 'Search_new')
     self.go.SetMinSize((50, 24))
     self.go.Bind(wx.EVT_LEFT_UP, self.OnSearchKeyDown)
     
     def createToggle(label, event):
         button = wx.ToggleButton(self, -1, label)
         button.Bind(wx.EVT_TOGGLEBUTTON, event)
         return button
     
     self.channels = createToggle('Channels', self.OnChannels)
     self.settings = createToggle('Settings', self.OnSettings)
     self.my_files = createToggle('Downloads', self.OnLibrary)
     self.results = createToggle('Results', self.OnResults)
     self.results.Disable()
 
     self.home = createToggle('Home', self.OnHome)
     
     if sys.platform == 'win32':
         self.files_friends = wx.StaticBitmap(self, -1, self.Bitmap("images/search_files_channels.png", wx.BITMAP_TYPE_ANY))
         self.tribler_logo2 = wx.StaticBitmap(self, -1, self.Bitmap("images/logo4video2_win.png", wx.BITMAP_TYPE_ANY))
     else:
         self.files_friends = wx.StaticText(self, -1, "Search Files or Channels")
         self.tribler_logo2 = wx.StaticBitmap(self, -1, self.Bitmap("images/logo4video2.png", wx.BITMAP_TYPE_ANY))
         if sys.platform == 'linux2':
             self.files_friends.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, 0, "Nimbus Sans L"))
         elif sys.platform == 'darwin': # mac
             self.files_friends.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, 0, ""))
     
     self.tribler_logo2.Bind(wx.EVT_LEFT_UP, self.OnStats)
     
     
     self.notifyPanel = wx.Panel(self)
     self.notifyPanel.SetBackgroundColour("yellow")
     self.notifyIcon = wx.StaticBitmap(self.notifyPanel, -1, wx.ArtProvider.GetBitmap(wx.ART_INFORMATION))
     self.notify = wx.StaticText(self.notifyPanel)
     
     notifyS = wx.BoxSizer(wx.HORIZONTAL)
     notifyS.Add(self.notifyIcon, 0, wx.LEFT | wx.TOP | wx.BOTTOM, 5)
     notifyS.Add(self.notify, 1, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
     self.notifyPanel.SetSizer(notifyS)
     self.notifyPanel.Hide()
     
     self.__do_layout()
     self.Layout()
     
     self.Bind(wx.EVT_SIZE, self.OnResize)
    def addComponents(self):
        self.Show(False)
        #self.SetMinSize((50,50))
        self.selectedColour = wx.Colour(255, 200, 187)
        self.unselectedColour = wx.WHITE

        self.SetBackgroundColour(self.unselectedColour)
        self.hSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.Bind(wx.EVT_LEFT_UP, self.mouseAction)
        self.Bind(wx.EVT_KEY_UP, self.keyTyped)

        # Add Spacer
        self.hSizer.Add([8, 22], 0, wx.EXPAND | wx.FIXED_MINSIZE, 0)

        # Add Checkbox turn on/off
        self.cB = wx.CheckBox(self, -1, "", wx.Point(8, 128), wx.Size(18, 18))
        self.cB.SetForegroundColour(wx.Colour(0, 0, 0))
        self.hSizer.Add(self.cB, 0, wx.TOP | wx.LEFT | wx.RIGHT, 3)

        # Add Spacer
        self.hSizer.Add([0, 20], 0, wx.EXPAND | wx.FIXED_MINSIZE, 0)

        # Add thumb / favicon from website?
        self.thumb = FavicoThumbnailViewer(self)
        self.thumb.setBackground(wx.BLACK)
        self.thumb.SetSize((16, 16))
        self.hSizer.Add(self.thumb, 0, wx.TOP | wx.RIGHT, 3)

        # Add title
        self.title = wx.StaticText(
            self, -1, "Tribler discovery through other Tribler Users",
            wx.Point(0, 0), wx.Size(800, 20))
        #self.title.SetBackgroundColour(wx.BLUE)
        self.title.SetFont(
            wx.Font(FS_SUBSCRTITLE, FONTFAMILY, FONTWEIGHT, wx.NORMAL, False,
                    FONTFACE))
        self.title.SetMinSize((550, 20))
        self.hSizer.Add(self.title, 1, wx.TOP | wx.RIGHT, 5)

        # Add title
        #self.today =wx.StaticText(self,-1,"today: 10 files",wx.Point(0,0),wx.Size(140,18))
        #self.today.SetBackgroundColour(wx.WHITE)
        #self.today.SetFont(wx.Font(10,FONTFAMILY,FONTWEIGHT,wx.NORMAL,False,FONTFACE))
        #self.today.SetMinSize((140,18))
        #self.hSizer.Add(self.today, 0, wx.BOTTOM|wx.TOP|wx.RIGHT, 3)

        # Add left vertical line
        #        self.vLine1 = self.addLine()
        """
        # Add total number of received files
        self.totalnumber =wx.StaticText(self,-1,"",wx.Point(0,0),wx.Size(130,12))        
        self.totalnumber.SetBackgroundColour(wx.WHITE)
        self.totalnumber.SetFont(wx.Font(FS_TOTALNUMBER,FONTFAMILY,FONTWEIGHT,wx.NORMAL,False,FONTFACE))
        self.totalnumber.SetForegroundColour(wx.Colour(128,128,128))        
        self.totalnumber.SetMinSize((60,12))
        self.totalnumber.SetLabel('') 
        self.hSizer.Add(self.totalnumber,0,wx.TOP|wx.EXPAND,3)
        
        # Add left vertical line
        self.vLine2 = self.addLine()
        """

        # Add Spacer to keep space occupied when no delete button is available
        self.vSizer = wx.BoxSizer(wx.VERTICAL)
        self.vSizer.Add([20, 1], 0, wx.FIXED_MINSIZE, 0)

        # Add delete button
        self.delete = tribler_topButton(self,
                                        -1,
                                        wx.Point(0, 0),
                                        wx.Size(16, 16),
                                        name='deleteSubscriptionItem')
        self.vSizer.Add(self.delete, 0, wx.TOP, 3)

        self.hSizer.Add(self.vSizer, 0, wx.LEFT | wx.RIGHT | wx.TOP, 0)

        # Add Spacer
        self.hSizer.Add([8, 20], 0, wx.EXPAND | wx.FIXED_MINSIZE, 0)

        self.SetSizer(self.hSizer)
        self.SetAutoLayout(1)
        self.Layout()
        self.Refresh()

        self.Bind(wx.EVT_CHECKBOX, self.checkboxAction, self.cB)

        # 2.8.4.2 return value of GetChildren changed
        wl = []
        for c in self.GetChildren():
            wl.append(c)
        for window in wl:
            window.Bind(wx.EVT_LEFT_UP, self.mouseAction)
            window.Bind(wx.EVT_KEY_UP, self.keyTyped)
            window.Bind(wx.EVT_RIGHT_DOWN, self.mouseAction)