本文整理汇总了Python中Preferences.IS类的典型用法代码示例。如果您正苦于以下问题:Python IS类的具体用法?Python IS怎么用?Python IS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadBitmap
def loadBitmap(name):
""" Loads bitmap if it exists, else loads default bitmap """
imgPath = 'Images/Palette/' + name+'.png'
try:
return IS.load(imgPath)
except IS.Error:
return IS.load('Images/Palette/Component.png')
示例2: __init__
def __init__(self, parent, lang=wx.LANGUAGE_DEFAULT, filter='boa',
boaLangs=(wx.LANGUAGE_DEFAULT,)):
self._init_ctrls(parent)
self.filterMap = {'boa': langlistctrl.LC_ONLY,
'available': langlistctrl.LC_AVAILABLE,
'all': langlistctrl.LC_ALL}
self.filterIdxMap = {0: 'boa',
1: 'available',
2: 'all'}
self.boaLangs = boaLangs
self.langCtrl = langlistctrl.LanguageListCtrl(self.langCtrlContainer, -1,
filter=self.filterMap[filter], only=boaLangs, select=lang,
style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL | wx.SUNKEN_BORDER)
# reset min sizes for all controls except the language selector
Utils.resetMinSize(self, (self.langCtrlContainer,))
# set language selector size
self.OnLangCtrlContainerSize()
# now set the sizer properly
self.SetSizerAndFit(self.mainSizer)
self.SetIcon(IS.load('Images/Icons/LanguageSelect.ico'))
示例3: __init__
def __init__(self, parent, debugger):
DebuggerListCtrl.__init__(self, parent, wxID_BREAKVIEW)
self.InsertColumn(0, _("Module"), wx.LIST_FORMAT_LEFT, 90)
self.InsertColumn(1, _("Line"), wx.LIST_FORMAT_CENTER, 40)
self.InsertColumn(2, _("Ignore"), wx.LIST_FORMAT_CENTER, 45)
self.InsertColumn(3, _("Hits"), wx.LIST_FORMAT_CENTER, 45)
self.InsertColumn(4, _("Condition"), wx.LIST_FORMAT_LEFT, 250)
self.brkImgLst = wx.ImageList(16, 16)
self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-red.png"))
self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-yellow.png"))
self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-gray.png"))
self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-blue.png"))
self.Bind(wx.EVT_LEFT_DCLICK, self.OnGotoSource)
self.debugger = debugger
self.menu = wx.Menu()
self.menu.Append(wxID_BREAKSOURCE, _("Goto source"))
self.menu.Append(wxID_BREAKREFRESH, _("Refresh"))
self.menu.AppendSeparator()
self.menu.Append(wxID_BREAKIGNORE, _("Edit ignore count"))
self.menu.Append(wxID_BREAKEDIT, _("Edit condition"))
self.menu.Append(wxID_BREAKDELETE, _("Delete"))
self.menu.AppendSeparator()
self.menu.Append(wxID_BREAKENABLED, _("Enabled"), "", True)
self.menu.Check(wxID_BREAKENABLED, True)
self.Bind(wx.EVT_MENU, self.OnGotoSourceRight, id=wxID_BREAKSOURCE)
self.Bind(wx.EVT_MENU, self.OnRefresh, id=wxID_BREAKREFRESH)
self.Bind(wx.EVT_MENU, self.OnEditIgnore, id=wxID_BREAKIGNORE)
self.Bind(wx.EVT_MENU, self.OnEditCondition, id=wxID_BREAKEDIT)
self.Bind(wx.EVT_MENU, self.OnDelete, id=wxID_BREAKDELETE)
self.Bind(wx.EVT_MENU, self.OnToggleEnabled, id=wxID_BREAKENABLED)
self.pos = None
self.setPopupMenu(self.menu)
self.AssignImageList(self.brkImgLst, wx.IMAGE_LIST_SMALL)
self.bps = []
self.stats_map = {}
示例4: _init_coll_toolBar_Tools
def _init_coll_toolBar_Tools(self, parent):
# generated method, don't edit
parent.AddTool(bitmap=IS.load('Images/Shared/Inspector.png'),
id=wxID_BOAFRAMETOOLBARTOOLS0, isToggle=False, longHelpString='',
pushedBitmap=wx.NullBitmap,
shortHelpString=_('Brings the Inspector to the front'))
parent.AddTool(bitmap=IS.load('Images/Shared/Editor.png'),
id=wxID_BOAFRAMETOOLBARTOOLS1, isToggle=False, longHelpString='',
pushedBitmap=wx.NullBitmap,
shortHelpString=_('Brings the Editor to the front'))
self.Bind(wx.EVT_TOOL, self.OnInspectorToolClick,
id=wxID_BOAFRAMETOOLBARTOOLS0)
self.Bind(wx.EVT_TOOL, self.OnEditorToolClick,
id=wxID_BOAFRAMETOOLBARTOOLS1)
parent.Realize()
示例5: __init__
def __init__(self, editor, list, inspector, controllers):
ExplorerNodes.Controller.__init__(self, editor)
self.list = list
self.menu = wx.Menu()
self.svnOptions = '-z7'
self.svnMenuDef = [
(wxID_SVNUPDATE, 'Update', self.OnUpdateSVNItems, self.updateBmp),
(wxID_SVNCOMMIT, 'Commit', self.OnCommitSVNItems, self.commitBmp),
(wxID_SVNRESOLVED, 'Resolved', self.OnResolvedSVNItems, '-'),
(-1, '-', None, ''),
(wxID_SVNADD, 'Add', self.OnAddSVNItems, self.addBmp),
(wxID_SVNREMOVE, 'Remove', self.OnRemoveSVNItems, self.removeBmp),
(-1, '-', None, ''),
(wxID_SVNDIFF, 'Diff', self.OnDiffSVNItems, self.diffBmp),
(wxID_SVNLOG, 'Log', self.OnLogSVNItems, self.logBmp),
(wxID_SVNSTATUS, 'Status', self.OnStatusSVNItems, self.statusBmp),
(wxID_SVNINFO, 'Info', self.OnInfoSVNItems, '-'),
#(-1, '-', None, ''),
#(wxID_SVNLOCK, 'Lock', self.OnLockSVNItems, '-'),
#(wxID_SVNUNLOCK, 'Unlock', self.OnUnlockSVNItems, '-'),
]
self.setupMenu(self.menu, self.list, self.svnMenuDef)
self.fileSVNMenuDef = [
#(wxID_FSSVNIMPORT, 'Import', self.OnImportSVNFSItems, '-'),
(wxID_FSSVNCHECKOUT, 'Checkout', self.OnCheckoutSVNFSItems, '-'),
]
self.fileSVNMenu = wx.Menu()
self.setupMenu(self.fileSVNMenu, self.list, self.fileSVNMenuDef, False)
self.images = wx.ImageList(16, 16)
for svnImg in ( 'Images/CvsPics/File.png',
'Images/CvsPics/BinaryFile.png',
'Images/CvsPics/ModifiedFile.png',
'Images/CvsPics/ModifiedBinaryFile.png',
'Images/CvsPics/MissingFile.png',
'Images/CvsPics/ConflictingFile.png',
'Images/CvsPics/Dir.png',
'Images/Modules/FolderUp.png',
'Images/CvsPics/UnknownDir.png',
'Images/CvsPics/UnknownFile.png'):
self.images.Add(IS.load(svnImg))
self.toolbarMenus = [self.svnMenuDef]
FSSVNFolderNode.images = self.images
示例6: addTools
def addTools(self, toolbar):
if self.list.node and self.controllers.has_key(self.list.node.protocol):
prot = self.list.node.protocol
tbMenus = []
for menuLst in self.controllers[prot].toolbarMenus:
tbMenus.extend(list(menuLst))
for wID, name, meth, bmp in tbMenus:
if name == '-' and not bmp:
toolbar.AddSeparator()
elif bmp != '-':
if name[0] == '+':
# XXX Add toggle button
name = name [1:]
Utils.AddToolButtonBmpObject(self.editor, toolbar,
IS.load(bmp), name, meth)
示例7: addViewTools
def addViewTools(self, toolbar):
addedSep = False
for name, meth, bmp, accls in self.actions:
if name == '-' and not bmp:
toolbar.AddSeparator()
addedSep = True
elif bmp != '-':
if name[0] == '+':
# XXX Add toggle button
name = name [1:]
if not addedSep:
# this is the separator between File and Edit
toolbar.AddSeparator()
addedSep = True
Utils.AddToolButtonBmpObject(self.model.editor, toolbar,
IS.load(bmp), name, meth)
示例8: __init__
def __init__(self, editor):
import Utils
conf = Utils.createAndReadConfig('Explorer')
self.writeConfig = Utils.writeConfig
if conf and conf.has_section('debugger.remote'):
host = conf.get('debugger.remote', 'host')
port = conf.get('debugger.remote', 'port')
user = conf.get('debugger.remote', 'user')
pwd = eval(conf.get('debugger.remote', 'passwd'))
if pwd is not None:
from Explorers import scrm
pwd = scrm.scramble(pwd)
paths = eval(conf.get('debugger.remote', 'paths'))
else:
host, port, user, pwd, paths = self.rem_host, self.rem_port, \
self.rem_user, self.rem_pass, self.rem_pths
self.conf = conf
self.host = '127.0.0.1'
if host is not None: self.host = host
self.port = '26200'
if port is not None: self.port = port
self.user = ''
if user is not None: self.user = user
self.pwd = ''
if pwd is not None: self.pwd = pwd
self.paths = []
if paths is not None: self.paths[:] = paths
self._init_ctrls(editor)
self.editor = editor
self.pathsPanel.init_paths(self.paths)
self.Center(wx.BOTH)
try:
from Preferences import IS
self.SetIcon(IS.load('Images/Icons/Debug.ico'))
except Exception:#ImportError: # for testing standalone
pass
示例9: __init__
def __init__(self, parent, model):
id = wx.NewId()
wx.TreeCtrl.__init__(self, parent, id, style=wx.TR_HAS_BUTTONS | wx.SUNKEN_BORDER)
EditorView.__init__(self, model,
((_('Goto line'), self.OnGoto, self.gotoLineBmp, ''),), 0)
self.tokenImgLst = wx.ImageList(16, 16)
for hierImg in ('Images/Views/Hierarchy/inherit.png',
'Images/Views/Hierarchy/inherit_base.png',
'Images/Views/Hierarchy/inherit_outside.png',
'Images/Modules/'+self.model.bitmap):
self.tokenImgLst.Add(IS.load(hierImg))
self.SetImageList(self.tokenImgLst)
self.Bind(wx.EVT_KEY_UP, self.OnKeyPressed)
self.canExplore = True
self.active = True
示例10: evalCtrl
def evalCtrl(expr, localsDct=None, preserveExc=True):
""" Function usually used to evaluate source snippets.
Uses the namespace of this module which contain all the wxPython libs
and also adds param localDct.
"""
global _NB
if not _NB:
_NB = IS.load('Images/Inspector/wxNullBitmap.png')
if localsDct is None:
localsDct = {}
localsDct['_'] = lambda x: x
wx.NullBitmap = _NB
try:
return eval(expr, globals(), localsDct)
except Exception, err:
if preserveExc:
raise
else:
clsName = err.__class__.__name__
raise DesignTimeExpressionError, clsName+': '+str(err)
示例11: AddToolButtonBmpIS
def AddToolButtonBmpIS(frame, toolbar, name, hint, triggermeth, toggleBmp = ''):
if toggleBmp:
return AddToggleToolButtonBmpObject(frame, toolbar, IS.load(name), hint[:85], triggermeth)
else:
return AddToolButtonBmpObject(frame, toolbar, IS.load(name), hint[:85], triggermeth)
示例12: AddToolButtonBmpFile
def AddToolButtonBmpFile(frame, toolbar, filename, hint, triggermeth):
return AddToolButtonBmpObject(frame, toolbar, IS.load(filename),
hint, triggermeth)
示例13: __init__
def __init__(self, parent, collEditView, additAdders = (),
lvStyle = wx.LC_REPORT):
self.collEditPos = (-1, -1)
self.collEditPos = getNextDefaultPos()
self._init_ctrls(parent)
self.itemList = wx.ListCtrl(size = wx.DefaultSize,
id = wxID_COLLECTIONEDITORITEMLIST, parent = self,
name = 'itemList', style = lvStyle | wx.LC_SINGLE_SEL | wx.SUNKEN_BORDER,
pos = wx.DefaultPosition)
self.itemList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnObjectSelect, id=wxID_COLLECTIONEDITORITEMLIST)
self.itemList.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnObjectDeselect, id=wxID_COLLECTIONEDITORITEMLIST)
self.itemList.Bind(wx.EVT_LEFT_DCLICK, self.OnObjectDClick)
self.SetIcon(IS.load('Images/Icons/Collection.ico'))
self.collEditView = collEditView
self.selected = -1
self.additAdders = additAdders #= 0
self.additIds = {}
self.toolLst = []
acclst = []
wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
'Images/Shared/NewItem.png', _('New'), self.OnNewClick)
self.Bind(wx.EVT_MENU, self.OnNewClick, id=wId)
acclst.append( (keyDefs['Insert'][0], keyDefs['Insert'][1], wId) )
self.toolLst.append(wId)
if additAdders:
wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
'Images/Shared/NewItems.png', _('More new ...'), self.OnMoreNewClick)
self.Bind(wx.EVT_MENU, self.OnMoreNewClick, id=wId)
self.toolLst.append(wId)
self.toolBar.AddSeparator()
wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
'Images/Shared/DeleteItem.png', _('Delete'), self.OnDeleteClick)
self.Bind(wx.EVT_MENU, self.OnDeleteClick, id=wId)
acclst.append( (keyDefs['Delete'][0], keyDefs['Delete'][1], wId) )
self.toolLst.append(wId)
self.toolBar.AddSeparator()
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/up.png',
_('Up'), self.OnUpClick)
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/down.png',
_('Down'), self.OnDownClick)
self.toolBar.AddSeparator()
wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
'Images/Editor/Refresh.png', _('Refresh'), self.OnRefresh)
self.Bind(wx.EVT_MENU, self.OnRefresh, id=wId)
acclst.append( (keyDefs['Refresh'][0], keyDefs['Refresh'][1], wId) )
self.toolLst.append(wId)
wId = wx.NewId()
self.Bind(wx.EVT_MENU, self.OnSwitchToInspector, id=wId)
acclst.append( (keyDefs['Inspector'][0], keyDefs['Inspector'][1], wId) )
wId = wx.NewId()
self.Bind(wx.EVT_MENU, self.OnSwitchToDesigner, id=wId)
acclst.append( (keyDefs['Designer'][0], keyDefs['Designer'][1], wId) )
self.SetAcceleratorTable(wx.AcceleratorTable(acclst))
self.toolBar.Realize()
if lvStyle == wx.LC_REPORT:
self.itemList.InsertColumn(0, _('Name'), width=180)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.winConfOption = 'collectioneditor'
self.loadDims()
# Hack to force a refresh, it's not displayed correctly initialy
self.SetSize((self.GetSize().x +1, self.GetSize().y))
示例14: __init__
def __init__(self, parent):
self._init_ctrls(parent)
self.winConfOption = 'classbrowser'
self.loadDims()
self.SetIcon(IS.load('Images/Icons/ClassBrowser.ico'))
self.classes = {}
for module in ('wx', 'wx.html', 'wx.calendar', 'wx.grid', 'wx.stc',
'wx.gizmos', 'wx.wizard'):
self.classes.update(pyclbr.readmodule(module))
tID =wx.NewId()
root = self.hierarchy.AddRoot('wx.Object')
clsDict = {}
for i in self.classes.keys():
travTilBase(i, self.classes, clsDict)
buildTree(self.hierarchy, root, clsDict)
self.hierarchy.Expand(root)
tID =wx.NewId()
root = self.tree.AddRoot(_('Modules'))
modules = {}
moduleName = ''
for className in self.classes.keys():
moduleName = os.path.basename(self.classes[className].file)
if not modules.has_key(moduleName):
modules[moduleName] = {}
modules[moduleName][className] = {}
modules[moduleName][className]['Properties'] = {}
modules[moduleName][className]['Methods'] = {}
modules[moduleName][className]['Built-in'] = {}
for method in self.classes[className].methods.keys():
if (method[:2] == '__'):
modules[moduleName][className]['Built-in'][method] = self.classes[className].lineno
elif (method[:3] == 'Get'):
if self.classes[className].methods.has_key('Set'+method[3:]):
modules[moduleName][className]['Properties'][method[3:]] = self.classes[className].lineno
else:
modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
elif (method[:3] == 'Set'):
if self.classes[className].methods.has_key('Get'+method[3:]):
modules[moduleName][className]['Properties'][method[3:]] = self.classes[className].lineno
else:
modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
else:
modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
moduleLst = modules.keys()
moduleLst.sort()
for module in moduleLst:
roots = self.tree.AppendItem(root, module)
classLst = modules[module].keys()
classLst.sort()
for classes in classLst:
aClass = self.tree.AppendItem(roots, classes)
methItem = self.tree.AppendItem(aClass, _('Methods'))
for methods in modules[module][classes]['Methods'].keys():
methodsItem = self.tree.AppendItem(methItem, methods)
propItem = self.tree.AppendItem(aClass, _('Properties'))
for properties in modules[module][classes]['Properties'].keys():
propertyItem = self.tree.AppendItem(propItem, properties)
bInItem = self.tree.AppendItem(aClass, _('Built-in'))
for builtIns in modules[module][classes]['Built-in'].keys():
builtInItem = self.tree.AppendItem(bInItem, builtIns)
suprItem = self.tree.AppendItem(aClass, _('Super'))
for supers in self.classes[classes].super:
try:
superItem = self.tree.AppendItem(suprItem, supers.name)
except AttributeError:
superItem = self.tree.AppendItem(suprItem, supers)
self.tree.Expand(root)
示例15: __init__
def __init__(self, editor, filename=None, slave_mode=1):
wx.Frame.__init__(self, editor, -1, _('Debugger'),
style=wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN|Preferences.childFrameStyle)
self.winConfOption = 'debugger'
self.loadDims()
self.editor = editor
self.running = 0
self.slave_mode = slave_mode
if filename:
self.setDebugFile(filename)
else:
self.filename = ''
self.SetIcon(IS.load('Images/Icons/Debug.ico'))
self.viewsImgLst = wx.ImageList(16, 16)
self.viewsImgLst.Add(IS.load('Images/Debug/Stack.png'))
self.viewsImgLst.Add(IS.load('Images/Debug/Breakpoints.png'))
self.viewsImgLst.Add(IS.load('Images/Debug/Watches.png'))
self.viewsImgLst.Add(IS.load('Images/Debug/Locals.png'))
self.viewsImgLst.Add(IS.load('Images/Debug/Globals.png'))
self.viewsImgLst.Add(IS.load('Images/Debug/Output.png'))
self.invalidatePanes()
self.sb = DebugStatusBar(self)
self.SetStatusBar(self.sb)
self.toolbar = wx.ToolBar(self, -1,
style=wx.TB_HORIZONTAL | wx.NO_BORDER|flatTools)
self.SetToolBar(self.toolbar)
self.runId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Debug.png', _('Debug/Continue - %s')%keyDefs['Debug'][2],
self.OnDebug) #, runs in debugger, stops at breaks and exceptions'
self.runFullSpdId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/DebugFullSpeed.png', _('Debug/Continue full speed'),
self.OnDebugFullSpeed) #'stops only at hard (code) breaks and exceptions'
self.stepId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Step.png', _('Step - %s')%keyDefs['DebugStep'][2],
self.OnStep)
self.overId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Over.png', _('Over - %s')%keyDefs['DebugOver'][2],
self.OnOver)
self.outId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Out.png', _('Out - %s')%keyDefs['DebugOut'][2],
self.OnOut)
self.jumpId = -1
if sys.version_info[:2] >= (2, 3):
self.jumpId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Jump.png', _('Jump to line'), self.OnJump)
self.pauseId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Pause.png', _('Pause'), self.OnPause)
self.stopId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/Stop.png', _('Stop'), self.OnStop)
self.toolbar.AddSeparator()
self.sourceTraceId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/SourceTrace-Off.png', _('Trace in source'),
self.OnSourceTrace, '1')
self.debugBrowseId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/DebugBrowse.png', _('Debug browsing'),
self.OnDebugBrowse, '1')
if Preferences.psPythonShell == 'Shell':
self.shellNamespaceId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/ShellDebug.png', _('Eval in shell'),
self.OnDebugNamespace, '1')
else:
self.shellNamespaceId = -1
self.toolbar.AddSeparator()
self.pathMappingsId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/PathMapping.png', _('Edit client/server path mappings...'),
self.OnPathMappings)
self.splitOrientId = Utils.AddToolButtonBmpIS(self, self.toolbar,
'Images/Debug/SplitOrient.png', _('Toggle split orientation'),
self.OnToggleSplitOrient)
self.SetAcceleratorTable(wx.AcceleratorTable( [
(keyDefs['Debug'][0], keyDefs['Debug'][1], self.runId),
(keyDefs['DebugStep'][0], keyDefs['DebugStep'][1], self.stepId),
(keyDefs['DebugOver'][0], keyDefs['DebugOver'][1], self.overId),
(keyDefs['DebugOut'][0], keyDefs['DebugOut'][1], self.outId) ] ))
self.toolbar.Realize()
self.toolbar.ToggleTool(self.sourceTraceId, True)
self.toolbar.ToggleTool(self.debugBrowseId, False)
self.splitter = wx.SplitterWindow(self, -1,
style=wx.SP_NOBORDER|Preferences.splitterStyle)
(stackImgIdx, breaksImgIdx, watchesImgIdx, localsImgIdx,
globalsImgIdx) = range(5)
# Create a Notebook
self.nbTop = wx.Notebook(self.splitter, wxID_TOPPAGECHANGED)
self.nbTop.SetImageList(self.viewsImgLst)
#.........这里部分代码省略.........