当前位置: 首页>>代码示例>>Python>>正文


Python GUIUtility.getInstance方法代码示例

本文整理汇总了Python中Tribler.Main.vwxGUI.GuiUtility.GUIUtility.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python GUIUtility.getInstance方法的具体用法?Python GUIUtility.getInstance怎么用?Python GUIUtility.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tribler.Main.vwxGUI.GuiUtility.GUIUtility的用法示例。


在下文中一共展示了GUIUtility.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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()
开发者ID:Antiade,项目名称:tribler,代码行数:29,代码来源:home.py

示例2: wait_for_init

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
        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)
开发者ID:NielsZeilemaker,项目名称:tribler,代码行数:9,代码来源:test_gui_as_server.py

示例3: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
 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()
开发者ID:egbertbouman,项目名称:tribler-g,代码行数:9,代码来源:ChessBoardPanel.py

示例4: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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()
开发者ID:ebcayabyab-personal,项目名称:swiftarm,代码行数:27,代码来源:home.py

示例5: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
 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 = {}
开发者ID:duy,项目名称:tribler,代码行数:27,代码来源:GuiDBHandler.py

示例6: _PostInit

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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()
开发者ID:nomadsummer,项目名称:cs198mojo,代码行数:29,代码来源:TextButton.py

示例7: _PostInit

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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()
开发者ID:nomadsummer,项目名称:cs198mojo,代码行数:27,代码来源:tribler_topButton.py

示例8: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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
开发者ID:Anbcorp,项目名称:tribler,代码行数:31,代码来源:IconsManager.py

示例9: _PostInit

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
 def _PostInit(self):
     # Do all init here
     self.guiUtility = GUIUtility.getInstance()
     self.searchBitmap()
     self.createBackgroundImage()
     
     self.Refresh(True)
     self.Update()
开发者ID:nomadsummer,项目名称:cs198mojo,代码行数:10,代码来源:standardStatus.py

示例10: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
 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()
开发者ID:egbertbouman,项目名称:tribler-g,代码行数:10,代码来源:GamesOverviewPanel.py

示例11: start

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
            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)
开发者ID:Azzhag,项目名称:tribler,代码行数:19,代码来源:CreateTorrentDialog.py

示例12: load_icons

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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)
开发者ID:Anbcorp,项目名称:tribler,代码行数:10,代码来源:list_bundle.py

示例13: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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)
开发者ID:Antiade,项目名称:tribler,代码行数:60,代码来源:SRstatusbar.py

示例14: __init__

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
 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()
开发者ID:egbertbouman,项目名称:tribler-g,代码行数:11,代码来源:GamesPanel.py

示例15: helpClick

# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import getInstance [as 别名]
    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()
开发者ID:ebcayabyab-personal,项目名称:swiftarm,代码行数:58,代码来源:list_header.py


注:本文中的Tribler.Main.vwxGUI.GuiUtility.GUIUtility.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。