def __init__(self): if GUIDBProducer.__single: raise RuntimeError, "GuiDBProducer is singleton" #Lets get the reference to the shared database_thread from Tribler.Core.Session import Session if Session.has_instance(): self.database_thread = Session.get_instance().lm.database_thread else: raise RuntimeError('Session not initialized') self.guitaskqueue = GUITaskQueue.getInstance() #Lets get a reference to utility from Tribler.Main.vwxGUI.GuiUtility import GUIUtility if GUIUtility.hasInstance(): self.utility = GUIUtility.getInstance().utility else: Utility = namedtuple('Utility', ['abcquitting',]) self.utility = Utility(False) self.uIds = set() self.uIdsLock = Lock() self.nrCallbacks = {}
def on_added_source(self, _): """ this function called when user clicked 'OK' button for adding source """ if self.rss_feed_radio.GetValue(): self.source = self.rss_feed_edit.GetValue() else: self.source = self.rss_dir_edit.GetValue() GUIUtility.getInstance().Notify( "Successfully add source for credit mining %s" % self.source) self.EndModal(wx.ID_OK)
def _PostInit(self): # Do all init here self.guiUtility = GUIUtility.getInstance() self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.Bind(wx.EVT_LEFT_UP, self.ClickedButton) if '_' in self.GetName(): label = self.GetName()[:self.GetName().find('_')] else: label = self.GetName() self.sizer = wx.BoxSizer(wx.VERTICAL) self.labelobj = wx.StaticText(self, -1, label) self.labelobj.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.labelobj.Bind(wx.EVT_LEFT_UP, self.ClickedButton) self.sizer.Add(self.labelobj, 1, wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT, 5) #self.SetLabel(' '+label) self.SetMinSize((60,-1)) #self.SetSize(75,18) self.SetBackgroundColour(self.colours[int(self.selected)]) self.SetSizer(self.sizer) self.Refresh(True) self.Update()
def __init__(self, parent, title, background, hspacer=(0, 0)): wx.Panel.__init__(self, parent) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.SetBackgroundColour(background) self.SetForegroundColour(parent.GetForegroundColour()) spacerFlags = 0 if hspacer[0]: spacerFlags |= wx.LEFT if hspacer[1]: spacerFlags |= wx.RIGHT spacer = max(hspacer) vSizer = wx.BoxSizer(wx.VERTICAL) self.header = self.CreateHeader() self.header.SetTitle(title) self.header.SetBackgroundColour(background) vSizer.Add(self.header, 0, wx.EXPAND | spacerFlags, spacer) self.panel = self.CreatePanel() if self.panel: vSizer.Add(self.panel, 1, wx.EXPAND | spacerFlags, spacer) self.footer = self.CreateFooter() self.footer.SetBackgroundColour(background) vSizer.Add(self.footer, 0, wx.EXPAND | spacerFlags, spacer) self.SetSizer(vSizer) self.Layout()
def _PostInit(self): # print "<mluc> tribler_topButton in _PostInit" # Do all init here self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.Bind(wx.EVT_LEFT_UP, self.ClickedButton) self.selected = False self.tooltip = None self.old_bitmaps = None #bitmaps that were initially loaded on the button with searchBitmaps function, and now have been changed to some provisory ones using switchTo self.searchBitmaps() self.createBackgroundImage() #<mluc> on mac, the button doesn't get a size #if self.bitmaps[0] and self.GetSize()==(0,0): if self.bitmaps[0]: self.SetSize(self.bitmaps[0].GetSize()) # print >> sys.stderr, self.Name # print >> sys.stderr, 'size' # print >> sys.stderr, self.Size self.initDone = True self.Refresh(True) self.Update()
def __init__(self, parent): wx.Panel.__init__(self, parent) self.SetBackgroundColour(wx.WHITE) self.SetForegroundColour(parent.GetForegroundColour()) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.OnExpand = lambda *args: None self.OnCollapse = lambda *args: None self.update_interval = 120 self.max_torrents = 20 self.is_xxx = {} self.list = ListBody(self, self, [{'width': wx.LIST_AUTOSIZE}], 0, 0, True, False, grid_columns=self.max_torrents, horizontal_scroll=True) self.list.SetBackgroundColour(self.GetBackgroundColour()) vSizer = wx.BoxSizer(wx.VERTICAL) vSizer.Add( DetailHeader(self, "Start streaming immediately by clicking on one of the items below"), 0, wx.EXPAND) vSizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(vSizer) self.Layout() self.refreshNow()
def __init__(self): if IconsManager.__single: raise RuntimeError("IconsManager is singleton") from Tribler.Main.vwxGUI.GuiUtility import GUIUtility self.guiUtility = GUIUtility.getInstance() self.guiImagePath = os.path.join(self.guiUtility.utility.getPath(), 'Tribler', 'Main', 'vwxGUI', 'images') self.defaults = {'PEER_THUMB': {}, 'TORRENT': {}, 'TORRENT_NEW': {}, 'MODIFICATION': {}, 'REVERTED_MODIFICATION': {}, 'COMMENT':{}, 'MARKING':{}} self.defaults['PEER_THUMB'][ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'defaultThumbPeer.png')) self.defaults['TORRENT'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'file_extension_tor.png')) self.defaults['TORRENT_NEW'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'file_extension_tornew.png')) self.defaults['MODIFICATION'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'edit_diff.png')) self.defaults['REVERTED_MODIFICATION'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'edit_reverted.png')) self.defaults['COMMENT'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'comments.png')) self.defaults['MARKING'][SMALL_ICON_MAX_DIM] = wx.Bitmap(os.path.join(self.guiImagePath, 'marking.png')) # Load country flags used by list_details self.country_flags = {} # For OS X, we do not use the country flags due to a wx bug if sys.platform != "darwin": flags_path = os.path.join(self.guiImagePath, 'flags') if os.path.isdir(flags_path): self.country_flags = dict([(flag.split(".")[0].lower(), wx.Bitmap(os.path.join(flags_path, flag), wx.BITMAP_TYPE_ANY)) for flag in os.listdir(flags_path)]) self.peer_db = self.guiUtility.utility.session.open_dbhandler(NTFY_PEERS) IconsManager.__single = self
def _post_init(self): if GUIUtility.getInstance().utility.abcquitting: return some_ready = any( [i.ready for i in self.boosting_manager.boosting_sources.values()]) # if none are ready, keep waiting or If no source available if not some_ready and len( self.boosting_manager.boosting_sources.values()): self.register_task( str(self) + "_post_init", reactor.callLater(2, self._post_init)) return for _, source_obj in self.boosting_manager.boosting_sources.items(): self.sourcelist.create_source_item(source_obj) self.sourcelist.Show() self.main_splitter.ReplaceWindow(self.loading_holder, self.sourcelist) self.loading_holder.Close() self.Bind(ULC.EVT_LIST_ITEM_SELECTED, self.on_sourceitem_selected, self.sourcelist) self.register_task( str(self) + "_load_more", reactor.callLater(2, self.sourcelist.load_more)) self.Layout()
def __init__(self, parent, title, background): wx.Panel.__init__(self, parent) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.SetBackgroundColour(background) self.SetForegroundColour(parent.GetForegroundColour()) vSizer = wx.BoxSizer(wx.VERTICAL) self.header = self.CreateHeader() self.header.SetTitle(title) self.header.SetBackgroundColour(background) vSizer.Add(self.header, 0, wx.EXPAND) self.panel = self.CreatePanel() if self.panel: vSizer.Add(self.panel, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 1) self.footer = self.CreateFooter() self.footer.SetBackgroundColour(background) vSizer.Add(self.footer, 0, wx.EXPAND) self.SetSizer(vSizer) self.Layout()
def __init__(self, parent, *args): ChessBoardPanel.__init__(self, parent, *args) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.session = self.utility.session self.peer_db = self.guiUtility.utility.session.open_dbhandler(NTFY_PEERS) self.timer.Stop()
def __init__(self, parent, title, background, hspacer=(0, 0), vspacer=(0, 0)): wx.Panel.__init__(self, parent) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.SetBackgroundColour(background) self.SetForegroundColour(parent.GetForegroundColour()) spacerFlags = 0 if hspacer[0]: spacerFlags |= wx.LEFT if hspacer[1]: spacerFlags |= wx.RIGHT spacer = max(hspacer) vSizer = wx.BoxSizer(wx.VERTICAL) vSizer.AddSpacer((-1, vspacer[0])) self.header = self.CreateHeader() self.header.SetTitle(title) self.header.SetBackgroundColour(background) vSizer.Add(self.header, 0, wx.EXPAND | spacerFlags, spacer) self.panel = self.CreatePanel() if self.panel: vSizer.Add(self.panel, 1, wx.EXPAND | spacerFlags, spacer) self.footer = self.CreateFooter() self.footer.SetBackgroundColour(background) vSizer.Add(self.footer, 0, wx.EXPAND | spacerFlags, spacer) vSizer.AddSpacer((-1, vspacer[1])) self.SetSizer(vSizer) self.Layout()
def __init__(self, parent, text, icon="bullet_go.png", icon_type=None, icon_align=wx.ALIGN_RIGHT, font_increment=0, font_colour='#0473BB'): wx.BoxSizer.__init__(self, wx.HORIZONTAL) self.parent = parent self.icon_type = icon_type self.icon_align = icon_align if icon: self.icon = wx.StaticBitmap( parent, bitmap=wx.Bitmap( os.path.join(GUIUtility.getInstance().vwxGUI_path, 'images', icon), wx.BITMAP_TYPE_ANY)) self.icon.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) elif icon_type: self.icon = wx.StaticBitmap( parent, bitmap=NativeIcon.getInstance().getBitmap( parent, self.icon_type, parent.GetBackgroundColour(), state=0)) else: self.icon = None if self.icon and icon_align == wx.ALIGN_LEFT: self.Add(self.icon, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) normalfont = parent.GetFont() normalfont.SetPointSize(normalfont.GetPointSize() + font_increment) selectedfont = parent.GetFont() selectedfont.SetPointSize(normalfont.GetPointSize() + font_increment) selectedfont.SetUnderlined(True) self.text = LinkText(parent, text, fonts=[normalfont, selectedfont], colours=[font_colour, (255, 0, 0, 255)], parentsizer=self) self.Add(self.text, 1, wx.ALIGN_CENTER_VERTICAL) if self.icon and icon_align == wx.ALIGN_RIGHT: self.Add( self.icon, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RESERVE_SPACE_EVEN_IF_HIDDEN, 3) if self.icon and text == '': self.icon.Hide() self.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) if parent.GetBackgroundStyle() != wx.BG_STYLE_SYSTEM: self.SetBackgroundColour(parent.GetBackgroundColour())
def wait_for_init(): print >> sys.stderr, "tgs: lm initcomplete, staring to wait for frame to be ready" self.guiUtility = GUIUtility.getInstance() self.frame = self.guiUtility.frame self.CallConditional(30, lambda: self.frame.ready, callback)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'Remove boosting source', size=(475, 135), name="RemoveBoostingSourceDialog") self.guiutility = GUIUtility.getInstance() self.boosting_manager = self.guiutility.utility.session.lm.boosting_manager self.sources = [] self.source = '' text = wx.StaticText(self, -1, 'Please select the boosting source you wish to remove:') self.source_label = wx.StaticText(self, -1, 'Source:') self.source_choice = wx.Choice(self, -1) ok_btn = wx.Button(self, -1, "OK") ok_btn.Bind(wx.EVT_BUTTON, self.on_remove_source) cancel_btn = wx.Button(self, -1, "Cancel") cancel_btn.Bind(wx.EVT_BUTTON, self.on_cancel) sourcesizer = wx.BoxSizer(wx.HORIZONTAL) sourcesizer.Add(self.source_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) sourcesizer.Add(self.source_choice, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) btnsizer = wx.BoxSizer(wx.HORIZONTAL) btnsizer.Add(ok_btn, 0, wx.RIGHT | wx.TOP | wx.BOTTOM, 5) btnsizer.Add(cancel_btn, 0, wx.ALL, 5) vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(text, 0, wx.EXPAND | wx.ALL, 5) vsizer.Add(sourcesizer, 0, wx.EXPAND | wx.ALL, 5) vsizer.AddStretchSpacer() vsizer.Add(btnsizer, 0, wx.EXPAND | wx.ALL, 5) self.SetSizer(vsizer) # retrieve all source except channel source self.sources = [s.get_source_text() for s in self.boosting_manager.boosting_sources.values() if not isinstance(s, ChannelSource)] self.source_choice.SetItems(self.sources)
def __init__(self, parent, title, background): wx.Panel.__init__(self, parent) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.SetBackgroundColour(background) self.SetForegroundColour(parent.GetForegroundColour()) vSizer = wx.BoxSizer(wx.VERTICAL) self.header = self.CreateHeader() self.header.SetTitle(title) self.header.SetBackgroundColour(background) vSizer.Add(self.header, 0, wx.EXPAND) self.panel = self.CreatePanel() if self.panel: vSizer.Add(self.panel, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 1) self.footer = self.CreateFooter() self.footer.SetBackgroundColour(background) vSizer.Add(self.footer, 0, wx.EXPAND) self.SetSizer(vSizer) self.Layout()
def wait_for_init(): print >>sys.stderr, "tgs: lm initcomplete, staring to wait for frame to be ready" self.guiUtility = GUIUtility.getInstance() self.frame = self.guiUtility.frame self.CallConditional(30, lambda: self.frame.ready, callback)
def __init__(self, parent): wx.Panel.__init__(self, parent) self._logger = logging.getLogger(self.__class__.__name__) self.guiutility = GUIUtility.getInstance() self.createTimer = None self.isReady = False
def __init__(self, parent, itemPanel): self.itemPanel = itemPanel wx.Panel.__init__(self, parent, -1) self.columns = [] self.guiUtility = GUIUtility.getInstance() self.addComponents() #self.SetMinSize((-1,30)) self.Show(True)
def load_icons(cls): if not cls.icons: icons = cls.icons = {} guiUtility = GUIUtility.getInstance() utility = guiUtility.utility base_path = os.path.join(utility.getPath(), LIBRARYNAME, "Main", "vwxGUI", "images") icons['info'] = wx.Bitmap(os.path.join(base_path, "info.png"), wx.BITMAP_TYPE_ANY)
def start(): if self.combineRadio.GetValue(): self.progressDlg = wx.ProgressDialog( "Creating new .torrents", "Please wait while Tribler is creating your .torrents.\n" "This could take a while due to creating the required hashes.", maximum=max, parent=self, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE) else: self.progressDlg = wx.ProgressDialog( "Creating new .torrents", "Please wait while Tribler is creating your .torrents.\n" "This could take a while due to creating the required hashes.", maximum=max, parent=self, style=wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME | wx.PD_AUTO_HIDE) self.progressDlg.Pulse() self.progressDlg.cur = 0 GUIUtility.getInstance().utility.session.lm.threadpool.call_in_thread(0, create_torrents)
def _PostInit(self): # Do all init here self.guiUtility = GUIUtility.getInstance() self.searchBitmap() self.createBackgroundImage() self.Refresh(True) self.Update()
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.currentItem = None self.SetBackgroundColour(wx.WHITE) self.itemPanels = [] self.addComponents()
def __init__(self, parent): wx.StatusBar.__init__(self, parent, style=wx.ST_SIZEGRIP) # On Linux/OS X the resize handle and icons overlap, therefore we add an extra field. # On Windows this field is automatically set to 1 when the wx.ST_SIZEGRIP is set. self.SetFieldsCount(7) self.SetStatusStyles([wx.SB_FLAT] * 7) self.SetStatusWidths([-1, 250, 50, 19, 19, 19, 19]) self._gui_image_manager = GuiImageManager.getInstance() self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.library_manager = self.guiutility.library_manager self.ff_checkbox = wx.CheckBox(self, -1, 'Family filter', style=wx.ALIGN_RIGHT) self.ff_checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckbox) self.ff_checkbox.SetValue(self.guiutility.getFamilyFilter()) self.speed_down_icon = self._gui_image_manager.getBitmap(self, u"arrow", self.GetBackgroundColour(), state=0) self.speed_down_sbmp = wx.StaticBitmap(self, -1, self.speed_down_icon) self.speed_down_sbmp.Bind(wx.EVT_RIGHT_UP, self.OnDownloadPopup) self.speed_down = wx.StaticText(self, -1, '') self.speed_down.Bind(wx.EVT_RIGHT_UP, self.OnDownloadPopup) self.speed_up_icon = self.speed_down_icon.ConvertToImage().Rotate90().Rotate90().ConvertToBitmap() self.speed_up_sbmp = wx.StaticBitmap(self, -1, self.speed_up_icon) self.speed_up_sbmp.Bind(wx.EVT_RIGHT_UP, self.OnUploadPopup) self.speed_up = wx.StaticText(self, -1, '') self.speed_up.Bind(wx.EVT_RIGHT_UP, self.OnUploadPopup) self.free_space_icon = self._gui_image_manager.getImage(u"drive.png") self.free_space_sbmp = wx.StaticBitmap(self, -1, self.free_space_icon) self.free_space = wx.StaticText(self, -1, '') self.searchConnectionImages = [u"progressbarEmpty.png", u"progressbarFull.png"] self.searchConnectionImages = [self._gui_image_manager.getImage(image) for image in self.searchConnectionImages] self.activityImages = [u"statusbar_activity.png", u"statusbar_noactivity.png"] self.activityImages = [self._gui_image_manager.getImage(image) for image in self.activityImages] self.connection = HorizontalGauge(self, self.searchConnectionImages[0], self.searchConnectionImages[1]) self.activity = wx.StaticBitmap(self, -1, self.activityImages[1]) self.activity_timer = None self.channelconnections = 0 self.bmp_firewall_warning = self._gui_image_manager.getImage(u"statusbar_warning.png") self.bmp_firewall_ok = self._gui_image_manager.getImage(u"statusbar_ok.png") self.firewallStatus = ActionButton(self, -1, self.bmp_firewall_warning) self.firewallStatus.SetSize((16, 16)) self.firewallStatus.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.firewallStatus.SetToolTipString('Port status unknown') self.firewallStatus.Enable(False) self.firewallStatus.SetBitmapDisabled(self.bmp_firewall_warning) self.SetTransferSpeeds(0, 0) self.Bind(wx.EVT_SIZE, self.OnSize) self.library_manager.add_download_state_callback(self.RefreshTransferSpeed)
def __init__(self, *args): wx.Panel.__init__(self, *args) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.Hide() self.SetBackgroundColour(wx.WHITE) self.addComponents() self.SwitchPanel("Chess") self.Show()
def helpClick(self,event=None): title = 'Search within results' html = """<p> <u>Search within results</u> allows you to filter a list with ease.<br> Typing a simple string, will allow you to filter items. <br> If you type 'ab', only items matching it will be shown: <ul> <li><b>AB</b>C</li> <li><b>ab</b>c</li> <li>d<b>ab</b>c</li> </ul> <hr> But you can specify more advanced queries. Search within results will additionally allow you to use regex and size filters. I.e. <ul> <li>'\d{4}' will show only items with a 4 digit number</li> <li>'size=100:200' will show items between 100 and 200 Mbytes</li> <li>'size=:200' will show items smaller than 200 Mbytes</li> <li>'size=100:' will show items larger than 100 Mbytes</li> </ul> <hr> Finally if you are in the Library you can filter items by state, i.e. <ul> <li>'state=completed' will show only items which are completed</li> <li>'state=active' will show items which currently are being downloaded or seeded</li> <li>'state=seeding' will show items which are seeding</li> <li>'state=downloading' will show items which are downloading</li> <li>'state=stopped' will show items which are stopped/paused and not completed</li> <li>'state=checking' will show items which are currently checking or scheduled to be checked</li> </ul> </p>""" dlg = wx.Dialog(GUIUtility.getInstance().frame, -1, title, style=wx.DEFAULT_DIALOG_STYLE, size=(500,300)) dlg.CenterOnParent() dlg.SetBackgroundColour(DEFAULT_BACKGROUND) sizer = wx.FlexGridSizer(2,2) icon = wx.StaticBitmap(dlg, -1, wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_MESSAGE_BOX)) sizer.Add(icon, 0, wx.TOP, 10) hwin = wx.html.HtmlWindow(dlg, -1, size = (600, 400)) hwin.SetPage(html) sizer.Add(hwin) sizer.Add((10,0)) btn = wx.Button(dlg, wx.ID_OK, 'Ok') sizer.Add(btn, 0, wx.ALIGN_RIGHT, 5) border = wx.BoxSizer() border.Add(sizer, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 10) dlg.SetSizerAndFit(border) dlg.ShowModal() dlg.Destroy()
def loadPopularTorrentNames(self, num_torrents, force_refresh=False): if not self.popular_torrents or force_refresh: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility from Tribler.Main.vwxGUI.SearchGridManager import ChannelManager results = ChannelManager.getInstance( ).getMostPopularTorrentsFromChannel( self.id, ['Torrent.Name'], family_filter=GUIUtility.getInstance().getFamilyFilter(), limit=num_torrents) self.popular_torrents = [result[0] for result in results]
def __init__(self, database_thread): if GUIDBProducer.__single: raise RuntimeError("GuiDBProducer is singleton") self.database_thread = database_thread self.guitaskqueue = GUITaskQueue.getInstance() # Lets get a reference to utility from Tribler.Main.vwxGUI.GuiUtility import GUIUtility if GUIUtility.hasInstance(): self.utility = GUIUtility.getInstance().utility else: Utility = namedtuple('Utility', ['abcquitting', ]) self.utility = Utility(False) self.uIds = set() self.uIdsLock = Lock() self.nrCallbacks = {}
def __init__(self, parent, content = "", selected = False, *args, **kwargs): wx.Panel.__init__(self, parent, *args, **kwargs) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.content = content self.selected = selected self.selectedColour = self.guiUtility.selectedColour self.unselectedColour = self.guiUtility.unselectedColour self.SetMinSize((-1,22)) self.addComponents()
def __init__(self, parent): PlotCanvas.__init__(self, parent) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.plot_graphics = None self.visible = False #visibility flag set manually self.uploadIsNegative = False #flag to set upload view as negative self.showTotal = False self.showTotal2 = False self.showAll = False #unused yet self.currentItem = None #unused yet self.selectedABCTorrent = None #the torrent currently selected in library view? # self.utility = frame.utility # get the utility object of parent frame, should be there! # Create mouse event for showing cursor coords in status bar #self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown, None, wx.NewId()) #self.mouseLeftDownText = None #self.mouseX, self.mouseY = 0,0 # Show closest point when enabled #self.Bind(wx.EVT_MOTION, self.OnMotion, None, wx.NewId()) # Save file key action #self.Bind(wx.EVT_CHAR, self.OnChar, self, wx.NewId()) # self.Bind(wx.EVT_KEY_DOWN, self.OnChar, self, wx.NewId()) # Paint event self.SetBackgroundColour("white") wx.EVT_PAINT(self, self.OnPaint) #Bar Graph Example """Just to reset the fonts back to the PlotCanvas defaults""" self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)) self.SetFontSizeAxis(10) self.SetFontSizeLegend(7) #self.SetEnablePointLabel(True) #self.SetEnableZoom(False) self.SetGridColour('gray') self.SetShowScrollbars(False) self.SetEnableLegend(True) #turn on Legend self.SetEnableGrid(True) #turn on Grid self.SetXSpec('none') #turns off x-axis scale self.SetYSpec('auto') self.my_DataDict = None # history of downloading and uploading rates # as dictionary: 'total down/up':array, torrent1: array, torrent2: array, and so on self.down_data = {} self.up_data = {} # first call to create the plot #self.updateData() # register the timer to periodically call updateData #ID_Timer = wx.NewId() #self.timer = wx.Timer(self, ID_Timer) #self.Bind( wx.EVT_TIMER, self.OnMyTimer, self.timer) #self.timer.Start(5000) self.timer = MyTimer(self.OnMyTimer) self.timer.start(5) #update each 5 seconds
def __init__(self, parent): wx.StatusBar.__init__(self, parent, style=wx.ST_SIZEGRIP) # On Linux/OS X the resize handle and icons overlap, therefore we add an extra field. # On Windows this field is automatically set to 1 when the wx.ST_SIZEGRIP is set. self.SetFieldsCount(6) self.SetStatusStyles([wx.SB_FLAT] * 6) self.SetStatusWidths([-1, 250, 19, 19, 19, 19]) self.guiutility = GUIUtility.getInstance() self.utility = self.guiutility.utility self.library_manager = self.guiutility.library_manager self.uelog = UserEventLogDBHandler.getInstance() self.ff_checkbox = wx.CheckBox(self, -1, 'Family filter', style=wx.ALIGN_RIGHT) self.ff_checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckbox) self.ff_checkbox.SetValue(self.guiutility.getFamilyFilter()) self.speed_down_icon = NativeIcon.getInstance().getBitmap(self, 'arrow', self.GetBackgroundColour(), state=0) self.speed_down_sbmp = wx.StaticBitmap(self, -1, self.speed_down_icon) self.speed_down_sbmp.Bind(wx.EVT_RIGHT_UP, self.OnDownloadPopup) self.speed_down = StaticText(self, -1, '', style=wx.ST_NO_AUTORESIZE) self.speed_down.Bind(wx.EVT_RIGHT_UP, self.OnDownloadPopup) self.speed_up_icon = self.speed_down_icon.ConvertToImage().Rotate90().Rotate90().ConvertToBitmap() self.speed_up_sbmp = wx.StaticBitmap(self, -1, self.speed_up_icon) self.speed_up_sbmp.Bind(wx.EVT_RIGHT_UP, self.OnUploadPopup) self.speed_up = StaticText(self, -1, '', style=wx.ST_NO_AUTORESIZE) self.speed_up.Bind(wx.EVT_RIGHT_UP, self.OnUploadPopup) self.searchConnectionImages = ['progressbarEmpty.png', 'progressbarFull.png'] self.searchConnectionImages = [os.path.join(self.guiutility.vwxGUI_path, 'images', image) for image in self.searchConnectionImages] self.searchConnectionImages = [wx.Bitmap(image, wx.BITMAP_TYPE_ANY) for image in self.searchConnectionImages] self.activityImages = ['statusbar_activity.png', 'statusbar_noactivity.png'] self.activityImages = [os.path.join(self.guiutility.vwxGUI_path, 'images', image) for image in self.activityImages] self.activityImages = [wx.Bitmap(image, wx.BITMAP_TYPE_ANY) for image in self.activityImages] self.connection = HorizontalGauge(self, self.searchConnectionImages[0], self.searchConnectionImages[1]) self.activity = wx.StaticBitmap(self, -1, self.activityImages[1]) self.activity_timer = None self.channelconnections = 0 self.bmp_firewall_warning = wx.Bitmap(os.path.join(self.utility.getPath(), LIBRARYNAME, "Main", "vwxGUI", "images", "statusbar_warning.png")) self.bmp_firewall_ok = wx.Bitmap(os.path.join(self.utility.getPath(), LIBRARYNAME, "Main", "vwxGUI", "images", "statusbar_ok.png")) self.firewallStatus = ActionButton(self, -1, self.bmp_firewall_warning) self.firewallStatus.SetSize((16, 16)) self.firewallStatus.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.firewallStatus.SetToolTipString('Port status unknown') self.firewallStatus.Enable(False) self.firewallStatus.SetBitmapDisabled(self.bmp_firewall_warning) self.SetTransferSpeeds(0, 0) self.Bind(wx.EVT_SIZE, self.OnSize) self.library_manager.add_download_state_callback(self.RefreshTransferSpeed)
def __init__(self, parent): PlotCanvas.__init__(self, parent) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.plot_graphics = None self.visible = False #visibility flag set manually self.uploadIsNegative = False #flag to set upload view as negative self.showTotal = False self.showTotal2 = False self.showAll = False #unused yet self.currentItem = None #unused yet self.selectedABCTorrent = None #the torrent currently selected in library view? # self.utility = frame.utility # get the utility object of parent frame, should be there! # Create mouse event for showing cursor coords in status bar #self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown, None, wx.NewId()) #self.mouseLeftDownText = None #self.mouseX, self.mouseY = 0,0 # Show closest point when enabled #self.Bind(wx.EVT_MOTION, self.OnMotion, None, wx.NewId()) # Save file key action #self.Bind(wx.EVT_CHAR, self.OnChar, self, wx.NewId()) # self.Bind(wx.EVT_KEY_DOWN, self.OnChar, self, wx.NewId()) # Paint event self.SetBackgroundColour("white") wx.EVT_PAINT( self, self.OnPaint) #Bar Graph Example """Just to reset the fonts back to the PlotCanvas defaults""" self.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL)) self.SetFontSizeAxis(10) self.SetFontSizeLegend(7) #self.SetEnablePointLabel(True) #self.SetEnableZoom(False) self.SetGridColour('gray') self.SetShowScrollbars(False) self.SetEnableLegend(True) #turn on Legend self.SetEnableGrid(True) #turn on Grid self.SetXSpec('none') #turns off x-axis scale self.SetYSpec('auto') self.my_DataDict = None # history of downloading and uploading rates # as dictionary: 'total down/up':array, torrent1: array, torrent2: array, and so on self.down_data = {} self.up_data = {} # first call to create the plot #self.updateData() # register the timer to periodically call updateData #ID_Timer = wx.NewId() #self.timer = wx.Timer(self, ID_Timer) #self.Bind( wx.EVT_TIMER, self.OnMyTimer, self.timer) #self.timer.Start(5000) self.timer = MyTimer(self.OnMyTimer) self.timer.start(5) #update each 5 seconds
def GetRightTitlePanel(self, parent): hSizer = SearchHeader.GetRightTitlePanel(self, parent) #filename = os.path.join(os.path.dirname(__file__), "images", "help.png") gui_utility = GUIUtility.getInstance() filename = os.path.join(gui_utility.vwxGUI_path, "images", "help.png") help = wx.StaticBitmap(parent, -1, wx.Bitmap(filename, wx.BITMAP_TYPE_ANY)) help.Bind(wx.EVT_LEFT_UP, self.helpClick) hSizer.Add(help, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT, 5) return hSizer
def __init__(self, filterData = []): self.filterData = filterData self.filterState = {} self.filters = {} self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.state = None pre = wx.PrePanel() # the Create step is done by XRC. self.PostCreate(pre) self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate)
def _PostInit(self): # Do all init here self.guiUtility = GUIUtility.getInstance() self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.Bind(wx.EVT_LEFT_UP, self.guiUtility.buttonClicked) self.searchBitmaps() self.createBackgroundImage() if self.bitmaps[0]: self.SetSize(self.bitmaps[0].GetSize()) self.Refresh(True) self.Update()
def __init__(self, database_thread): if GUIDBProducer.__single: raise RuntimeError("GuiDBProducer is singleton") self.database_thread = database_thread self.guitaskqueue = GUITaskQueue.getInstance() # Lets get a reference to utility from Tribler.Main.vwxGUI.GuiUtility import GUIUtility if GUIUtility.hasInstance(): self.utility = GUIUtility.getInstance().utility else: Utility = namedtuple('Utility', [ 'abcquitting', ]) self.utility = Utility(False) self.uIds = set() self.uIdsLock = Lock() self.nrCallbacks = {}
def _fillRequiredSection(self, st): # Version and other miscellaneous information try: guiUtility = GUIUtility.getInstance() utility = guiUtility.utility self.text.AppendText('%s version: %s\n' % (utility.lang.get('title'), utility.lang.get('version'))) except: pass # Traceback (actually just the first line of it) self.text.AppendText(st)
def _fillRequiredSection(self, st): # Version and other miscellaneous information try: guiUtility = GUIUtility.getInstance() utility = guiUtility.utility self.text.AppendText("%s version: %s\n" % (utility.lang.get("title"), utility.lang.get("version"))) except: pass # Traceback (actually just the first line of it) self.text.AppendText(st)
def __init__(self): super(SettingsDialog, self).__init__(None, size=(600, 600), title="Settings", name="settingsDialog", style=wx.DEFAULT_DIALOG_STYLE) self.SetExtraStyle(self.GetExtraStyle() | wx.WS_EX_VALIDATE_RECURSIVELY) self._logger = logging.getLogger(self.__class__.__name__) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.defaultDLConfig = DefaultDownloadStartupConfig.getInstance() # create the dialog and widgets self._tree_ctrl = wx.TreeCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_SINGLE) self._tree_ctrl.SetMinSize(wx.Size(150, -1)) tree_root = self._tree_ctrl.AddRoot('Root') self._tree_ctrl.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(self._tree_ctrl, 0, wx.EXPAND | wx.RIGHT, 10) self._general_panel, self._general_id = self.__create_s1(tree_root, hsizer) self._conn_panel, self._conn_id = self.__create_s2(tree_root, hsizer) self._bandwidth_panel, self._bandwidth_id = self.__create_s3(tree_root, hsizer) self._seeding_panel, self._seeding_id = self.__create_s4(tree_root, hsizer) self._experimental_panel, self._experimental_id = self.__create_s5(tree_root, hsizer) self._tunnel_panel, self._tunnel_id = self.__create_s6(tree_root, hsizer) self._general_panel.Show(True) self._conn_panel.Show(False) self._bandwidth_panel.Show(False) self._seeding_panel.Show(False) self._experimental_panel.Show(False) self._tunnel_panel.Show(False) self._save_btn = wx.Button(self, wx.ID_OK, label="Save") self._cancel_btn = wx.Button(self, wx.ID_CANCEL, label="Cancel") btn_sizer = wx.StdDialogButtonSizer() btn_sizer.AddButton(self._save_btn) btn_sizer.AddButton(self._cancel_btn) btn_sizer.Realize() self._save_btn.Bind(wx.EVT_BUTTON, self.saveAll) self._cancel_btn.Bind(wx.EVT_BUTTON, self.cancelAll) vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(hsizer, 1, wx.EXPAND | wx.ALL, 10) vsizer.Add(btn_sizer, 0, wx.EXPAND | wx.ALL, 5) self.SetSizer(vsizer) # select General page by default self._tree_ctrl.SelectItem(self._general_id)
def __init__(self, version, parent, name, msg_bold='', msg='', title='', center_on_frame=True): wx.Dialog.__init__(self, parent=parent, size=(475, 210), name=name) self.version = version self.SetTitle(title) messageSizer = wx.BoxSizer(wx.VERTICAL) if msg_bold: messageText1 = wx.StaticText(self, label=msg_bold) _set_font(messageText1, fontweight=wx.FONTWEIGHT_BOLD) messageSizer.Add(messageText1, 1, wx.EXPAND) if msg: messageText2 = wx.StaticText(self, label=msg) messageSizer.Add(messageText2, 1, wx.EXPAND | wx.TOP, 10 if msg_bold else 0) bodySizer = wx.BoxSizer(wx.HORIZONTAL) bodySizer.Add( wx.StaticBitmap( self, -1, wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_CMN_DIALOG)), 0, wx.ALIGN_TOP | wx.RIGHT, 25) bodySizer.Add(messageSizer, 1, wx.EXPAND) buttonSizer = wx.StdDialogButtonSizer() okButton = wx.Button(self, wx.ID_OK, label='Ok') okButton.Bind(wx.EVT_BUTTON, self.OnOk) laterButton = wx.Button(self, id=wx.ID_CANCEL, label='Later') laterButton.Bind(wx.EVT_BUTTON, self.OnLater) ignoreButton = wx.Button(self, id=wx.ID_IGNORE, label='Ignore') ignoreButton.Bind(wx.EVT_BUTTON, self.OnIgnore) buttonSizer.Add(ignoreButton) buttonSizer.Add(laterButton) buttonSizer.Add(okButton) buttonSizer.Realize() mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(bodySizer, 1, wx.EXPAND | wx.ALL, 10) mainSizer.Add(buttonSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 10) self.SetSizerAndFit(mainSizer) if center_on_frame: x, y, w, h = GUIUtility.getInstance().frame.GetScreenRect() self.SetPosition((x + ((w - self.GetSize().x) / 2), y + ((h - self.GetSize().y) / 2)))
def __init__(self): if IconsManager.__single: raise RuntimeError, "IconsManager is singleton" self.guiUtility = GUIUtility.getInstance() self.guiImagePath = os.path.join(self.guiUtility.utility.getPath(), 'Tribler', 'Main', 'vwxGUI', 'images') self.defaults = {} self.defaults['personsMode'] = {} self.defaults['personsMode']['DEFAULT_THUMB'] = wx.Bitmap(os.path.join(self.guiImagePath, 'defaultThumbPeer.png')) self.peer_db = self.guiUtility.utility.session.open_dbhandler(NTFY_PEERS) IconsManager.__single = self
def __init__(self, parent, parent_list, spacers=[10, 3]): self.guiutility = GUIUtility.getInstance() self.channellist_manager = parent_list.GetManager() self.channel_categories = ["All", "Popular", "New", "Updated", "Mine"] BaseFilter.__init__( self, parent, parent_list, ColumnsManager.getInstance( ).getColumns( ChannelListItem), spacers)
def __init__(self): if GUIDBProducer.__single: raise RuntimeError("GuiDBProducer is singleton") super(GUIDBProducer, self).__init__() self._logger = logging.getLogger(self.__class__.__name__) # Lets get a reference to utility from Tribler.Main.vwxGUI.GuiUtility import GUIUtility if GUIUtility.hasInstance(): self.utility = GUIUtility.getInstance().utility else: Utility = namedtuple('Utility', ['abcquitting', ]) self.utility = Utility(False) self.uIds = set() self.uIdsLock = Lock() self.nrCallbacks = {} self._auto_counter = 0
def __init__(self): if IconsManager.__single: raise RuntimeError("IconsManager is singleton") from Tribler.Main.vwxGUI.GuiUtility import GUIUtility self.guiUtility = GUIUtility.getInstance() self.guiImagePath = os.path.join(self.guiUtility.utility.getPath(), 'Tribler', 'Main', 'vwxGUI', 'images') self.defaults = { 'PEER_THUMB': {}, 'TORRENT': {}, 'TORRENT_NEW': {}, 'MODIFICATION': {}, 'REVERTED_MODIFICATION': {}, 'COMMENT': {}, 'MARKING': {} } self.defaults['PEER_THUMB'][ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'defaultThumbPeer.png')) self.defaults['TORRENT'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'file_extension_tor.png')) self.defaults['TORRENT_NEW'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'file_extension_tornew.png')) self.defaults['MODIFICATION'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'edit_diff.png')) self.defaults['REVERTED_MODIFICATION'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'edit_reverted.png')) self.defaults['COMMENT'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'comments.png')) self.defaults['MARKING'][SMALL_ICON_MAX_DIM] = wx.Bitmap( os.path.join(self.guiImagePath, 'marking.png')) # Load country flags used by list_details self.country_flags = {} # For OS X, we do not use the country flags due to a wx bug if sys.platform != "darwin": flags_path = os.path.join(self.guiImagePath, 'flags') if os.path.isdir(flags_path): self.country_flags = dict([ (flag.split(".")[0].lower(), wx.Bitmap(os.path.join(flags_path, flag), wx.BITMAP_TYPE_ANY)) for flag in os.listdir(flags_path) ]) self.peer_db = self.guiUtility.utility.session.open_dbhandler( NTFY_PEERS) IconsManager.__single = self
def __init__(self, parent, *args): ChessBoardPanel.__init__(self, parent, *args) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.session = self.utility.session self.session.add_observer(self.DatabaseCallback, NTFY_GAMECAST, [NTFY_UPDATE], 'Game') self.gamecast = GameCast.getInstance() self.gamecast_db = self.guiUtility.utility.session.open_dbhandler(NTFY_GAMECAST) self.guiserver = ChessTaskQueue.getInstance() self.peer_db = self.guiUtility.utility.session.open_dbhandler(NTFY_PEERS) self.my_clock = None self.opponent_clock = None self.rr_index = 0 self.finished = 0
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 GetRightTitlePanel(self, parent): hSizer = SearchHeaderHelper.GetRightTitlePanel(self, parent) #filename = os.path.join(os.path.dirname(__file__), "images", "help.png") gui_utility = GUIUtility.getInstance() filename = os.path.join(gui_utility.vwxGUI_path, "images", "help.png") help = wx.StaticBitmap(parent, -1, wx.Bitmap(filename, wx.BITMAP_TYPE_ANY)) help.Bind(wx.EVT_LEFT_UP, self.helpClick) help.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) hSizer.Add(help, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5) return hSizer
def __init__(self, *args, **kw): # self.SetWindowStyle(wx.LC_REPORT|wx.NO_BORDER|wx.LC_NO_HEADER|wx.LC_SINGLE_SEL) self.guiUtility = GUIUtility.getInstance() self.utility = self.guiUtility.utility self.backgroundColor = wx.Colour(102, 102, 102) #self.ForegroundColour = wx.Colour(0,0,0) self.isEmpty = True # used for DLFilesList.onListDClick self.updateFunc = None pre = wx.PreListCtrl() # the Create step is done by XRC. self.PostCreate(pre) self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate)
def __init__(self, parent, name, msg_bold='', msg='', title='', center_on_frame=True): wx.Dialog.__init__(self, parent=parent, size=(475, 210), name=name) self.SetTitle(title) self.checkbox = wx.CheckBox(self, label='Don\'t show this dialog again') self.checkbox.SetValue(False) messageSizer = wx.BoxSizer(wx.VERTICAL) if msg_bold: messageText1 = wx.StaticText(self, label=msg_bold) _set_font(messageText1, fontweight=wx.FONTWEIGHT_BOLD) messageSizer.Add(messageText1, 1, wx.EXPAND) if msg: messageText2 = wx.StaticText(self, label=msg) messageSizer.Add(messageText2, 1, wx.EXPAND | wx.TOP, 10 if msg_bold else 0) messageSizer.Add(self.checkbox, 0, wx.EXPAND | wx.TOP, 15) bodySizer = wx.BoxSizer(wx.HORIZONTAL) bodySizer.Add( wx.StaticBitmap( self, -1, wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_CMN_DIALOG)), 0, wx.ALIGN_TOP | wx.RIGHT, 15) bodySizer.Add(messageSizer, 1, wx.EXPAND) buttonSizer = wx.StdDialogButtonSizer() confirmButton = wx.Button(self, wx.ID_OK, label='Confirm') confirmButton.Bind(wx.EVT_BUTTON, self.OnConfirm) cancelButton = wx.Button(self, id=wx.ID_CANCEL) cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel) buttonSizer.Add(confirmButton) buttonSizer.Add(cancelButton) buttonSizer.Realize() mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(bodySizer, 1, wx.EXPAND | wx.ALL, 10) mainSizer.Add(buttonSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 10) self.SetSizerAndFit(mainSizer) if center_on_frame: x, y, w, h = GUIUtility.getInstance().frame.GetScreenRect() self.SetPosition((x + ((w - self.GetSize().x) / 2), y + ((h - self.GetSize().y) / 2)))
def __init__(self): if GUIDBProducer.__single: raise RuntimeError("GuiDBProducer is singleton") super(GUIDBProducer, self).__init__() self._logger = logging.getLogger(self.__class__.__name__) # Lets get a reference to utility from Tribler.Main.vwxGUI.GuiUtility import GUIUtility if GUIUtility.hasInstance(): self.utility = GUIUtility.getInstance().utility else: Utility = namedtuple('Utility', [ 'abcquitting', ]) self.utility = Utility(False) self.uIds = set() self.uIdsLock = Lock() self.nrCallbacks = {} self._auto_counter = 0
def __init__(self, parent, tile, name): self.parent = parent self.tile = tile self.bitmap = None self.backgroundColour = DEFAULT_BACKGROUND self.guiUtility = GUIUtility.getInstance() self.xpos = self.ypos = 0 XRCPanel.__init__(self, parent) self.SetName(name) self.loadBitmap() wx.EVT_PAINT(self, self.OnPaint) self.Refresh()
def start(): if self.combineRadio.GetValue(): self.progressDlg = wx.ProgressDialog( "Creating new .torrents", "Please wait while Tribler is creating your .torrents.\n" "This could take a while due to creating the required hashes.", maximum=max, parent=self, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE) else: self.progressDlg = wx.ProgressDialog( "Creating new .torrents", "Please wait while Tribler is creating your .torrents.\n" "This could take a while due to creating the required hashes.", maximum=max, parent=self, style=wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME | wx.PD_AUTO_HIDE) self.progressDlg.Pulse() self.progressDlg.cur = 0 GUIUtility.getInstance( ).utility.session.lm.threadpool.call_in_thread( 0, create_torrents)
def _PostInit(self): # Do all init here self.guiUtility = GUIUtility.getInstance() # self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.Bind(wx.EVT_LEFT_UP, self.guiUtility.buttonClicked) self.createBackgroundImage() self.setIndex(0) #if self.bitmaps[0]: # self.SetSize(self.bitmaps[0].GetSize()) # print self.Name # print 'size' # print self.Size self.mouseOver = False self.Refresh(True) self.Update()
def __init__(self, tile, *args, **kw): self.backgroundColour = wx.Colour(102, 102, 102) from Tribler.Main.vwxGUI.GuiUtility import GUIUtility self.guiUtility = GUIUtility.getInstance() self.xpos = self.ypos = 0 self.tile = tile self.bitmap = None if len(args) == 0: pre = wx.PrePanel() # the Create step is done by XRC. self.PostCreate(pre) self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate) else: wx.Panel.__init__(self, *args, **kw) self._PostInit()