本文整理汇总了Python中Tribler.Main.vwxGUI.GuiUtility.GUIUtility类的典型用法代码示例。如果您正苦于以下问题:Python GUIUtility类的具体用法?Python GUIUtility怎么用?Python GUIUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GUIUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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 = {}
示例2: __init__
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()
示例3: __init__
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()
示例4: __init__
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
示例5: _PostInit
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()
示例6: __init__
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()
示例7: _PostInit
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()
示例8: wait_for_init
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)
示例9: load_icons
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)
示例10: start
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)
示例11: __init__
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()
示例12: _PostInit
def _PostInit(self):
# Do all init here
self.guiUtility = GUIUtility.getInstance()
self.searchBitmap()
self.createBackgroundImage()
self.Refresh(True)
self.Update()
示例13: __init__
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)
示例14: __init__
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()
示例15: helpClick
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()