def __init__(self,parent,id,title): wx.Frame.__init__(self, parent, -1, title, size = (592, 633), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.timer = wx.Timer(self, 1) self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.panel = wx.Panel(self, -1) self.panels_buttons = wx.Panel(self.panel, -1) self.onglets = Onglets(self.panel) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.onglets, 11, wx.EXPAND|wx.ALL, 2) self.sizer.Add(self.panels_buttons, 1, wx.EXPAND|wx.ALL, 2) self.getVersions() self.panel.SetSizer(self.sizer) self.panel.SetAutoLayout(True) self.onglets.liste_versions() self.onglets.liste_games() self.oldreload="" self.oldversions = [] self.add_games() self.button = wx.Button(self.panels_buttons, wx.ID_CLOSE, pos=(493, 5), size=wx.DefaultSize) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_BUTTON(self, wx.ID_REMOVE, self.delete) wx.EVT_BUTTON(self, wx.ID_ADD, self.install) wx.EVT_TREE_SEL_CHANGED(self, 106, self.unselect) wx.EVT_TREE_SEL_CHANGED(self, 107, self.unselect) wx.EVT_TREE_SEL_CHANGED(self, 111, self.select_game) wx.EVT_COMBOBOX(self, 112, self.assign) self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer) self.timer.Start(200)
def __init__(self, parent, id, title): self.download32 = WineVersionFetcher("x86") if (os.environ["AMD64_COMPATIBLE"] == "True"): self.download64 = WineVersionFetcher("amd64") wx.Frame.__init__(self, parent, -1, title, size=(750, 400 + Variables.windows_add_size), style=wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.timer = wx.Timer(self, 1) self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) # self.panel = wx.Panel(self, -1) self.onglets = WineVersionsNotebook(self) # self.sizer = wx.BoxSizer(wx.VERTICAL) # self.sizer.Add(self.onglets, 15, wx.EXPAND|wx.ALL, 2) self.getVersions("x86") if (os.environ["AMD64_COMPATIBLE"] == "True"): self.getVersions("amd64") # self.panel.SetSizer(self.sizer) # self.panel.SetAutoLayout(True) self.onglets.liste_versions() if (os.environ["AMD64_COMPATIBLE"] == "True"): self.onglets.liste_versions("amd64") self.oldreload32 = "" if (os.environ["AMD64_COMPATIBLE"] == "True"): self.oldreload64 = "" self.oldversions32 = [] if (os.environ["AMD64_COMPATIBLE"] == "True"): self.oldversions64 = [] # self.button = wx.Button(self.panels_buttons, wx.ID_CLOSE, _("Close"), pos=(510, 5), size=wx.DefaultSize) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_TREE_SEL_CHANGED(self, 106, self.unselect32) wx.EVT_TREE_SEL_CHANGED(self, 107, self.unselect32) wx.EVT_BUTTON(self, 108, self.delete32) wx.EVT_BUTTON(self, 109, self.install32) wx.EVT_TREE_SEL_CHANGED(self, 206, self.unselect64) wx.EVT_TREE_SEL_CHANGED(self, 207, self.unselect64) wx.EVT_BUTTON(self, 208, self.delete64) wx.EVT_BUTTON(self, 209, self.install64) self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer) self.timer.Start(200)
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TR_DEFAULT_STYLE, rootObject=None, rootLabel=None, rootIsNamespace=False, static=False): """Create FillingTree instance.""" wx.TreeCtrl.__init__(self, parent, id, pos, size, style) self.rootIsNamespace = rootIsNamespace import __main__ if rootObject is None: rootObject = __main__.__dict__ self.rootIsNamespace = True if rootObject is __main__.__dict__ and rootLabel is None: rootLabel = 'locals()' if not rootLabel: rootLabel = 'Ingredients' rootData = wx.TreeItemData(rootObject) self.item = self.root = self.AddRoot(rootLabel, -1, -1, rootData) self.SetItemHasChildren(self.root, self.objHasChildren(rootObject)) wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding) wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed) wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged) wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated) if not static: dispatcher.connect(receiver=self.push, signal='Interpreter.push')
def __init__(self, parent, wxId, id): base.Widget.__init__(self, wx.TreeCtrl(parent, wxId)) # Will be used when sending notifications. self.widgetId = id self.rootId = id + '-root' self.clear() # Load the tree icons. #images = wx.ImageList(16, 16) #images.Add(wx.Bitmap(paths.findBitmap('unchecked'))) #images.Add(wx.Bitmap(paths.findBitmap('checked'))) #images.Add(wx.Bitmap(paths.findBitmap('defcheck'))) #if host.isWindows(): # images.Add(wx.Bitmap(paths.findBitmap('closedfolder'))) # images.Add(wx.Bitmap(paths.findBitmap('openfolder'))) #self.getWxWidget().AssignImageList(images) ## @todo Should this be LEFT_UP? #wx.EVT_LEFT_DOWN(self.getWxWidget(), self.onItemClick) # Right-clicking in the tree must change the selection in # addition to displaying the context menu. #wx.EVT_RIGHT_DOWN(self.getWxWidget(), self.onRightClick) # We will not allow expanding totally empty categories. #wx.EVT_TREE_ITEM_EXPANDING(parent, wxId, self.onItemExpanding) wx.EVT_TREE_SEL_CHANGED(parent, wxId, self.onSelectionChanged)
def SetTreeCtrl(self, tree): self.SetControl(tree) wx.EVT_TREE_SEL_CHANGED(self.GetControl(), self.GetControl().GetId(), self.DoSelection) wx.EVT_ENTER_WINDOW(self.GetControl(), treeCtrl.CallDoLoadOutlineCallback) wx.EVT_RIGHT_DOWN(self.GetControl(), self.OnRightClick)
def _CreateControl(self, parent, id): treeCtrl = OutlineTreeCtrl(parent, id) wx.EVT_TREE_SEL_CHANGED(treeCtrl, treeCtrl.GetId(), self.DoSelection) wx.EVT_SET_FOCUS(treeCtrl, self.DoSelection) wx.EVT_ENTER_WINDOW(treeCtrl, treeCtrl.CallDoLoadOutlineCallback) wx.EVT_RIGHT_DOWN(treeCtrl, self.OnRightClick) return treeCtrl
def __init__(self, mainwindow, parent, id, style): wx.TreeCtrl.__init__(self, parent, id, style=style) self.parent=parent self.mainwindow=mainwindow wx.EVT_TREE_ITEM_EXPANDED(self, id, self.OnItemExpanded) wx.EVT_TREE_SEL_CHANGED(self,id, self.OnItemSelected) self.dirmenu=wx.Menu() self.dirmenu.Append(guihelper.ID_FV_NEWSUBDIR, "Make subdirectory ...") self.dirmenu.Append(guihelper.ID_FV_NEWFILE, "New File ...") self.dirmenu.AppendSeparator() self.dirmenu.Append(guihelper.ID_FV_BACKUP, "Backup directory ...") self.dirmenu.Append(guihelper.ID_FV_BACKUP_TREE, "Backup entire tree ...") self.dirmenu.Append(guihelper.ID_FV_RESTORE, "Restore ...") self.dirmenu.AppendSeparator() self.dirmenu.Append(guihelper.ID_FV_REFRESH, "Refresh") self.dirmenu.AppendSeparator() self.dirmenu.Append(guihelper.ID_FV_DELETE, "Delete") self.dirmenu.AppendSeparator() self.dirmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem") self.dirmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone") self.dirmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone") self.dirmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode") # generic menu self.genericmenu=wx.Menu() self.genericmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem") self.genericmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone") self.genericmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone") self.genericmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode") wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh) wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline) wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot) wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWSUBDIR, self.OnNewSubdir) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWFILE, self.OnNewFile) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_DELETE, self.OnDirDelete) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP, self.OnBackupDirectory) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP_TREE, self.OnBackupTree) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_RESTORE, self.OnRestore) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REFRESH, self.OnDirRefresh) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot) wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode) wx.EVT_RIGHT_DOWN(self, self.OnRightDown) wx.EVT_RIGHT_UP(self, self.OnRightUp) self.image_list=wx.ImageList(16, 16) self.img_dir=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER, wx.ART_OTHER, (16, 16))) self.img_dir_open=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER_OPEN, wx.ART_OTHER, (16, 16))) self.SetImageList(self.image_list) self.add_files=[] self.add_target="" self.droptarget=fileview.MyFileDropTarget(self, True, True) self.SetDropTarget(self.droptarget) self.ResetView()
def Init(self, plugins, pluginsDisabled): """Method called after the panel has been initialized.""" # Set window icon if not guiutil.IsMac(): self.SetIcon(guiutil.get_icon()) # Initialize controls self.tcPlugins = XRCCTRL(self, 'tcPlugins') self.panelTreeView = XRCCTRL(self, 'panelTreeView') self.panelProperties = XRCCTRL(self, 'panelProperties') self.lblName = XRCCTRL(self, 'lblName') self.lblAuthor = XRCCTRL(self, 'lblAuthor') self.lblPluginType = XRCCTRL(self, 'lblPluginType') self.lblVersion = XRCCTRL(self, 'lblVersion') self.lblVersionNumber = XRCCTRL(self, 'lblVersionNumber') self.lblDescription = XRCCTRL(self, 'lblDescription') self.checkEnabled = XRCCTRL(self, 'checkEnabled') self.lblMessage = XRCCTRL(self, 'lblMessage') self.btnGetMorePlugins = XRCCTRL(self, 'btnGetMorePlugins') self.btnDeletePlugin = XRCCTRL(self, 'btnDeletePlugin') self.plugins = plugins self.pluginsDisabled = set(pluginsDisabled) # Bind interface events to the proper methods # wx.EVT_BUTTON(self, XRCID('btnDeletePlugin'), self.DeletePlugin) wx.EVT_CHECKBOX(self, XRCID('checkEnabled'), self.OnEnablePlugin) wx.EVT_TREE_ITEM_ACTIVATED(self, XRCID('tcPlugins'), self.OnEnablePlugin) wx.EVT_TREE_SEL_CHANGED(self, XRCID('tcPlugins'), self.OnSelectTreeItem) wx.EVT_TREE_SEL_CHANGING(self, XRCID('tcPlugins'), self.OnSelectRootItem) # Modify the control and font size as needed font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if guiutil.IsMac(): children = list(self.Children) + \ list(self.panelTreeView.Children) + \ list(self.panelProperties.Children) for control in children: control.SetFont(font) control.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) XRCCTRL(self, 'wxID_OK').SetWindowVariant(wx.WINDOW_VARIANT_NORMAL) font.SetWeight(wx.FONTWEIGHT_BOLD) if guiutil.IsMSWindows(): self.tcPlugins.SetPosition((0, 3)) self.panelTreeView.SetWindowStyle(wx.STATIC_BORDER) if (guiutil.IsMac() or guiutil.IsGtk()): self.tcPlugins.SetPosition((-30, 0)) self.panelTreeView.SetWindowStyle(wx.SUNKEN_BORDER) self.lblName.SetFont(font) self.lblMessage.SetFont(font) self.Layout() self.InitPluginList() self.LoadPlugins()
def __init__(self,parent,id,title,logcheck="/dev/null",logtype=None): self.logtype = 1 self.logfile = None self.logname = "" self.need_redisplay = False wx.Frame.__init__(self, parent, -1, title, size = (810, 600+Variables.windows_add_size), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.SetTitle(_('{0} debugger').format(os.environ["APPLICATION_TITLE"])) #self.panelFenp = wx.Panel(self, -1) self.prefixes_item = {} self.logs_item = {} self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_NOBORDER) self.panelEmpty = wx.Panel(self.splitter, -1) self.panelNotEmpty = wx.Panel(self.splitter, -1) self.noselect = wx.StaticText(self.panelEmpty, -1, _('Please select a debug file'),pos=(0,150),style=wx.ALIGN_RIGHT) self.noselect.SetPosition(((570-self.noselect.GetSize()[0])/2,250)) self.noselect.Wrap(500) self.images = wx.ImageList(16, 16) self.list_game = wx.TreeCtrl(self.splitter, 900, size = wx.DefaultSize, style=wx.TR_HIDE_ROOT) wx.EVT_TREE_SEL_CHANGED(self, 900, self.analyseLog) self.list_game.SetSpacing(0); self.list_game.SetImageList(self.images) self.list_software() self.throttling = False self.line_buffer = "" self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer) self.AutoReload(self) self.timer.Start(10) self.logfile = "" # Debug control self.panelText = wx.Panel(self.panelNotEmpty, -1, size=(590,500), pos=(2,2)) # Hack, wxpython bug self.log_reader = wx.TextCtrl(self.panelText, 100, "", size=wx.Size(590,500), pos=(2,2), style=Variables.widget_borders|wx.TE_RICH2|wx.TE_READONLY|wx.TE_MULTILINE) self.log_reader.Bind(wx.EVT_SET_FOCUS, self.OnFocus) self.openTextEdit = wx.Button(self.panelNotEmpty, 101, _("Locate this logfile"), size=(400,30), pos=(70,512)) self.reportProblem = wx.Button(self.panelNotEmpty, 102, "", size=(400,30), pos=(70,552)) if(logcheck == "/dev/null"): self.HideLogFile() else: self.analyseReal(logtype,logcheck) wx.EVT_BUTTON(self,101,self.locate) wx.EVT_BUTTON(self,102,self.bugReport)
def dispose(self): """ Disposes of the contents of an editor. """ tree, self._tree = self._tree, None id = tree.GetId() wx.EVT_TREE_SEL_CHANGED(tree, id, None) wx.EVT_TREE_ITEM_ACTIVATED(tree, id, None) super(CustomEditor, self).dispose()
def setConversation(self, data): oldTree = self.tree tID = wx.NewId() self.tree = ConversationTree(self,tID, data) wx.EVT_TREE_SEL_CHANGED(self,tID,self.treeSelChanged) self.ReplaceWindow(oldTree,self.tree) oldTree.Destroy()
def __init__(self, parent, mw, id): wx.TreeCtrl.__init__(self, parent, id, style=wx.TR_HAS_BUTTONS) self.parent = parent self.mw = mw self.config = mw.config bmsize = (22, 22) wx.EVT_TREE_SEL_CHANGED(self, id, self.OnItemSelected) self.image_list = wx.ImageList(22, 22) self.img_dir = self.image_list.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, bmsize)) art = [ "phonebook", "wallpaper", "ringers", "calendar", "callhistory", "calls", "sms", "message", "memo", "file", "log", "todo", "playlist", "protocol", "console", "phone_root", "phone", "root_image", "media", "image", "video", "camera", "sounds" ] for k in art: s = "self.%s= self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_SEL_%s,wx.ART_TOOLBAR,bmsize))" % ( k, k.upper()) exec(s) self.SetImageList(self.image_list) if self.config.ReadInt('startwithtoday', 0): self.startuppage = 'Phone' else: self.startuppage = self.config.Read("viewnotebookpage", "") self.startuppage_item = None self.DeleteAllItems() self.active_phone = None self.active_panel = self.root_panel = widgets.RootWidget( self.parent, wx.NewId()) self.root = self.AddPage(None, self.root_panel, "BitPim", self.root_image) self.del_bmp, self.short_help_delete = self.root_panel.GetDeleteInfo() self.add_bmp, self.short_help_add = self.root_panel.GetAddInfo() self.lw = None self.lwdata = None self.filesystemwidget = None wx.EVT_RIGHT_UP(self, self.OnRightUp) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_KEY_UP(self, self.OnKeyUp) # add shared tabs self.lw = guiwidgets.LogWindow(self.parent) self.lw_id = self.AddPage(self.root, self.lw, "Log", self.log) # Final widgets that depend on config lv = self.config.ReadInt("viewlogdata", 0) if lv: self.OnViewLogData(None) fv = self.config.ReadInt("viewfilesystem", 0) if fv: self.OnViewFilesystem(None) wx.Yield()
def __init__(self, parent, mainframe): self.initmixin() wx.Panel.__init__(self, parent, -1) self.parent = parent self.mainframe = mainframe self.pref = mainframe.pref if not hasattr(self.pref, 'share_nodes'): self.pref.share_nodes = [] self.processors = {} # self.callplugin('add_process_class', self, self.processors) self.sizer = wx.BoxSizer(wx.VERTICAL) self.shareimagelist = imagelist = wx.ImageList(16, 16) #add share image list self.imagefiles = {} self.imageids = {} self.callplugin('add_images', self.imagefiles) for name, imagefile in self.imagefiles.items(): self.add_image(name, imagefile) self.tree = wx.TreeCtrl(self, -1, style = wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.TR_TWIST_BUTTONS|wx.TR_HAS_BUTTONS|wx.TR_ROW_LINES|wx.TR_HIDE_ROOT) self.tree.SetImageList(self.shareimagelist) self.sizer.Add(self.tree, 1, wx.EXPAND) self.root = self.tree.AddRoot('Share') self.nodes = {} self.ID = 1 self.read() wx.EVT_TREE_SEL_CHANGING(self.tree, self.tree.GetId(), self.OnChanging) wx.EVT_TREE_SEL_CHANGED(self.tree, self.tree.GetId(), self.OnChanged) wx.EVT_TREE_BEGIN_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnBeginChangeLabel) wx.EVT_TREE_END_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnChangeLabel) wx.EVT_TREE_ITEM_ACTIVATED(self.tree, self.tree.GetId(), self.OnSelected) wx.EVT_TREE_ITEM_RIGHT_CLICK(self.tree, self.tree.GetId(), self.OnRClick) wx.EVT_RIGHT_UP(self.tree, self.OnRClick) wx.EVT_TREE_DELETE_ITEM(self.tree, self.tree.GetId(), self.OnDeleteItem) wx.EVT_LEFT_DCLICK(self.tree, self.OnDoubleClick) wx.EVT_TREE_ITEM_EXPANDING(self.tree, self.tree.GetId(), self.OnExpanding) from modules import Id wx.EVT_UPDATE_UI(self, Id.makeid(self, 'IDPM_DEL'), self.OnUpdateUI) #add init process self.callplugin('init', self) self.SetSizer(self.sizer) self.SetAutoLayout(True) self.popmenus = None
def __init__(self, parent, session): super(NavigationPanel, self).__init__(parent) #enable the scroll bars on the scrolled window self.SetScrollRate(2, 2) self._rclick_menu = RightClickMenu(self) self.v_sizer = wx.BoxSizer(wx.VERTICAL) #note that we need a try except block for agwStyle because it #changed names between wx versions from style to agwstyle try: self.tree = customtreectrl.CustomTreeCtrl( self, wx.ID_ANY, agwStyle=(customtreectrl.TR_HIDE_ROOT | customtreectrl.TR_HAS_BUTTONS)) except: self.tree = customtreectrl.CustomTreeCtrl( self, wx.ID_ANY, style=(customtreectrl.TR_HIDE_ROOT | customtreectrl.TR_HAS_BUTTONS)) #disable the scroll bars which come with the tree control (otherwise #you end up with two sets sometimes!) self.tree.EnableScrolling(False, False) self.SetScrollbars(0, 0, 0, 0) self.v_sizer.Add(self.tree, 1, wx.EXPAND) self.__current_selection_id = None #add the session element as the root node root = self.tree.AddRoot(session.get_name(), data=wx.TreeItemData(session)) self.__el_id_mapping = {session.get_avoplot_id(): root} #bind avoplot events core.EVT_AVOPLOT_ELEM_SELECT(self, self.on_element_select) core.EVT_AVOPLOT_ELEM_DELETE(self, self.on_element_delete) core.EVT_AVOPLOT_ELEM_ADD(self, self.on_element_add) core.EVT_AVOPLOT_ELEM_RENAME(self, self.on_element_rename) #bind wx events wx.EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.on_tree_select_el) wx.EVT_TREE_ITEM_MENU(self, self.tree.GetId(), self.on_tree_el_menu) #do the layout self.SetSizer(self.v_sizer) self.v_sizer.Fit(self) self.SetAutoLayout(True)
def create_control(self, parent): """ Creates the file control and gets it ready for use. """ style = self.get_style() if len(self.filter) > 0: style |= wx.DIRCTRL_SHOW_FILTERS self._files = files = wx.GenericDirCtrl(parent, style=style, filter='|'.join(self.filter)) files.SetPath(self.file_name) self._tree = tree = files.GetTreeCtrl() wx.EVT_TREE_SEL_CHANGED(tree, tree.GetId(), self._select_file)
def __init__(self, parent, id): pydirctrl.PyDirCtrl.__init__(self, parent, id, initialDir="/mnt/flac") self.frame = parent self.id = id # wx.EVT_TREE_BEGIN_DRAG(self, self.id, self.OnBeginDrag) wx.EVT_TREE_SEL_CHANGED(self, self.id, self.OnSelChanged) # wx.EVT_RIGHT_DOWN(self, self.OnRightDown) # wx.EVT_MENU(self, self.menuRefreshId, self.OnRefresh) # wx.PostEvent(self.frame, events.ShowDirectoryEvent(config.persistDirControlPath)) wx.WakeUpIdle()
def test(): app = wx.PySimpleApp(0) f = wx.Frame(None, -1, "Test") tree = VirtualTree(f, sys.argv[1]) def on_sel_changed(event): print 'selected:', tree.GetPath() wx.EVT_TREE_SEL_CHANGED(tree, tree.GetId(), on_sel_changed) f.SetSize((600, 400)) app.SetTopWindow(f) f.Show() app.MainLoop()
def __init__(self, parent, filename): # Use the WANTS_CHARS style so the panel doesn't eat the Return key. wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS) wx.EVT_SIZE(self, self.OnSize) tID = wx.NewId() self.tree = MyTreeCtrl( self, tID, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS, #| wx.TR_MULTIPLE #| wx.TR_HIDE_ROOT ) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) # wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz) -> wx.ArtProvider.GetBitmap()/3 self.folderIdx = il.Add( wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.folderOpenIdx = il.Add( wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileIdx = il.Add( wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz)) #self.fileIdx = self.il.Add(images.getFile1Bitmap()) #self.smileidx = self.il.Add(images.getSmilesBitmap()) self.tree.SetImageList(il) self.il = il # NOTE: 1 tree items have to have a data object in order to be sorted. # 2 Since our compare just uses the labels we don't need real data, so we'll just # use None below for the item data. wx.EVT_TREE_ITEM_EXPANDED(self, tID, self.OnItemExpanded) wx.EVT_TREE_ITEM_COLLAPSED(self, tID, self.OnItemCollapsed) wx.EVT_TREE_SEL_CHANGED(self, tID, self.OnSelChanged) wx.EVT_TREE_BEGIN_LABEL_EDIT(self, tID, self.OnBeginEdit) wx.EVT_TREE_END_LABEL_EDIT(self, tID, self.OnEndEdit) wx.EVT_TREE_ITEM_ACTIVATED(self, tID, self.OnActivate) wx.EVT_LEFT_DCLICK(self.tree, self.OnLeftDClick) wx.EVT_RIGHT_DOWN(self.tree, self.OnRightClick) wx.EVT_RIGHT_UP(self.tree, self.OnRightUp) #?? wx.EVT_COMMAND(self, 103,103, self.OnFileOpened) # Newer wxWidgets has no EVT_COMMAND # load default tree if filename != "": self.reload_tree(filename)
def _init_contents(self): self.statusBar = self.CreateStatusBar() sizer = wx.BoxSizer(orient=wx.VERTICAL) self.dirPicker = wx.DirPickerCtrl(self, id=wx.ID_ANY, style=wx.DIRP_DIR_MUST_EXIST | wx.DIRP_USE_TEXTCTRL) sizer.Add( self.dirPicker, 0, # make vertically unstretchable wx.EXPAND | # make horizontally stretchable wx.ALL, # and make border all around ) self.splitter1 = wx.SplitterWindow(self, id=wx.ID_ANY, style=wx.SP_3D) sizer.Add( self.splitter1, 1, # make vertically stretchable wx.EXPAND | # make horizontally stretchable wx.ALL, # and make border all around ) self.textCtrl1 = wx.TextCtrl(self.splitter1, id=wx.ID_ANY, style=wx.TE_READONLY | wx.TE_MULTILINE) self.setSummaryText('(empty)') self.dir = wx.GenericDirCtrl( self.splitter1, wx.ID_ANY, dir=self.prefs['start_dir'], filter=self.prefs['file_filter'], ) # Select the starting folder and expand to it self.setCurrentDirectory(self.prefs['start_dir']) self.splitter1.SplitVertically(self.dir, self.textCtrl1) tree = self.dir.GetTreeCtrl() wx.EVT_TREE_SEL_CHANGED(self, tree.GetId(), self.OnSelectTreeCtrlItem) wx.EVT_SPLITTER_SASH_POS_CHANGED(self, self.splitter1.GetId(), self.OnSashMoved) #self.Bind(wx.EVT_SIZE, self.OnWindowGeometryChanged) self.Bind(wx.EVT_MOVE, self.OnWindowGeometryChanged) self.Bind(wx.EVT_DIRPICKER_CHANGED, self.OnSelectDirPicker) self.SetSizerAndFit(sizer)
def __init__(self, parent, application): id = wx.NewId() style = wx.TR_DEFAULT_STYLE|wx.TR_HAS_VARIABLE_ROW_HEIGHT if wx.Platform == '__WXGTK__': style |= wx.TR_NO_LINES|wx.TR_FULL_ROW_HIGHLIGHT elif wx.Platform == '__WXMAC__': style &= ~wx.TR_ROW_LINES wx.TreeCtrl.__init__(self, parent, id, style=style) root_node = Tree.Node(application) self.cur_widget = None # reference to the selected widget Tree.__init__(self, root_node, application) image_list = wx.ImageList(21, 21) image_list.Add(wx.Bitmap(os.path.join(common.wxglade_path, 'icons/application.xpm'), wx.BITMAP_TYPE_XPM)) for w in WidgetTree.images: ## WidgetTree.images[w] = image_list.Add(wx.Bitmap( ## WidgetTree.images[w], wx.BITMAP_TYPE_XPM)) WidgetTree.images[w] = image_list.Add( misc.get_xpm_bitmap(WidgetTree.images[w])) self.AssignImageList(image_list) root_node.item = self.AddRoot(_('Application'), 0) self.SetPyData(root_node.item, root_node) self.skip_select = 0 # necessary to avoid an infinite loop on win32, as # SelectItem fires an EVT_TREE_SEL_CHANGED event self.title = ' ' self.set_title(self.title) self.auto_expand = True # this control the automatic expansion of # nodes: it is set to False during xml loading self._show_menu = misc.wxGladePopupMenu('widget') # popup menu to # show toplevel # widgets SHOW_ID = wx.NewId() self._show_menu.Append(SHOW_ID, _('Show')) wx.EVT_TREE_SEL_CHANGED(self, id, self.on_change_selection) wx.EVT_RIGHT_DOWN(self, self.popup_menu) wx.EVT_LEFT_DCLICK(self, self.show_toplevel) wx.EVT_MENU(self, SHOW_ID, self.show_toplevel) def on_key_down(event): evt_flags = 0 if event.ControlDown(): evt_flags = wx.ACCEL_CTRL evt_key = event.GetKeyCode() for flags, key, function in misc.accel_table: if evt_flags == flags and evt_key == key: wx.CallAfter(function) break event.Skip() wx.EVT_KEY_DOWN(self, on_key_down)
def __init__(self, parent=None, id=-1, title="BitPim Protocol Analyser", data=None): """Start the show @param data: data to show. If None, then it will be obtained from the clipboard """ wx.Frame.__init__(self, parent, id, title, size=(800, 750), style=wx.DEFAULT_FRAME_STYLE) # add a status bar to display various status items self.CreateStatusBar(len(self._pane_widths)) self.SetStatusWidths(self._pane_widths) topsplit = wx.SplitterWindow(self, -1, style=wx.SP_3D | wx.SP_LIVE_UPDATE) self.list = Eventlist(topsplit, 12) botsplit = wx.SplitterWindow(topsplit, -1, style=wx.SP_3D | wx.SP_LIVE_UPDATE) topsplit.SplitHorizontally(self.list, botsplit, 300) self.tree = wx.TreeCtrl(botsplit, 23, style=wx.TR_DEFAULT_STYLE) self.hex = hexeditor.HexEditor(botsplit, _set_pos=self.set_pos, _set_sel=self.set_sel, _set_val=self.set_val) botsplit.SplitHorizontally(self.tree, self.hex, 200) if data is None: data = self.getclipboarddata() self.newdata(data) wx.EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnListBoxItem) wx.EVT_LIST_ITEM_ACTIVATED(self, self.list.GetId(), self.OnListBoxItem) wx.EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeSelection) self.Show()
def __init__(self, parent, image_size=(16, 16), **traits): """ Creates a new tree viewer. 'parent' is the toolkit-specific control that is the tree's parent. 'image_size' is a tuple in the form (int width, int height) that specifies the size of the label images (if any) displayed in the tree. """ # Base class constructor. super(TreeViewer, self).__init__(**traits) # Create the toolkit-specific control. self.control = tree = wx.TreeCtrl(parent, -1, style=self._get_style()) # Get our actual Id. wxid = tree.GetId() # Wire up the wx tree events. wx.EVT_CHAR(tree, self._on_char) wx.EVT_LEFT_DOWN(tree, self._on_left_down) wx.EVT_RIGHT_DOWN(tree, self._on_right_down) wx.EVT_TREE_ITEM_ACTIVATED(tree, wxid, self._on_tree_item_activated) wx.EVT_TREE_ITEM_COLLAPSED(tree, wxid, self._on_tree_item_collapsed) wx.EVT_TREE_ITEM_COLLAPSING(tree, wxid, self._on_tree_item_collapsing) wx.EVT_TREE_ITEM_EXPANDED(tree, wxid, self._on_tree_item_expanded) wx.EVT_TREE_ITEM_EXPANDING(tree, wxid, self._on_tree_item_expanding) wx.EVT_TREE_BEGIN_LABEL_EDIT(tree, wxid, self._on_tree_begin_label_edit) wx.EVT_TREE_END_LABEL_EDIT(tree, wxid, self._on_tree_end_label_edit) wx.EVT_TREE_BEGIN_DRAG(tree, wxid, self._on_tree_begin_drag) wx.EVT_TREE_SEL_CHANGED(tree, wxid, self._on_tree_sel_changed) # The image list is a wxPython-ism that caches all images used in the # control. self._image_list = ImageList(image_size[0], image_size[1]) if self.show_images: tree.AssignImageList(self._image_list) # Mapping from element to wx tree item Ids. self._element_to_id_map = {} # Add the root item. if self.input is not None: self._add_element(None, self.input) return
def __init__(self, parent, id, title): PlayOnLinuxWindow.__init__(self, parent, -1, title, size=(850, 550)) self.cats_icons = {} self.cats_links = {} self.descriptionFetcher = DescriptionFetcher() ## Window self.windowSizer = wx.BoxSizer(wx.VERTICAL) self._createHeader() self._createBody() self.SetSizer(self.windowSizer) self._createInstallWindowCategoryContentPanel() self._createWaitPanel() # Filter panel self._createFilterPanel() # Apps Navigation self._createAppNavigation() self._createAppDescription() ## Buttons self._createButtons() self.live = 0 self.openMin = False self.images_cat = wx.ImageList(22, 22) self.installButton.Enable(False) # wx.EVT_TREE_SEL_CHANGED(self, 105, self.AddApps) wx.EVT_TREE_SEL_CHANGED(self, 106, self.AppsDetails) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_BUTTON(self, wx.ID_APPLY, self.installapp) wx.EVT_BUTTON(self, wx.ID_REFRESH, self.UpdatePol) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_TREE_ITEM_ACTIVATED(self, 106, self.installapp) wx.EVT_TEXT(self, 110, self.search) wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 111, self.manual) wx.EVT_CHECKBOX(self, 401, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 402, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 403, self.CheckBoxReload)
def __init__(self,parent,data): wx.SplitterWindow.__init__(self,parent) tID = wx.NewId() self.tree = ConversationTree(self,tID,data) self.selectedTreeItem = None wx.EVT_TREE_SEL_CHANGED(self,tID,self.treeSelChanged) self.notebook = wx.Notebook(self,-1,(420,420))#,style=wx.CLIP_CHILDREN) self.props = PropWindow.PropWindow(self.notebook) self.notebook.AddPage(self.props,_("Properties")) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING,self.OnNotebookPageChanging,self.notebook) self.SplitHorizontally(self.tree,self.notebook,180) self.fileChangeCallback = None
def Init(self, roots, feeds, state): self.feeds = feeds self.state = state wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnExpandNode) wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelectNode) wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnActivateNode) GenericDispatch.EVT_DISPATCH(self, self.OnDispatchEvent) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) def iladd(name): icon = gui.geticon(name) try: return il.Add(icon) except wx.PyAssertionError, ex: log.exception("Failed to add icon %s to image list; "\ "it's probably corrupt.", name) return il.Add(gui.geticon('smiles')) # probably OK
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(450, 400)) splitter1 = wx.SplitterWindow(self, -1, style=wx.SP_3D) splitter2 = wx.SplitterWindow(splitter1, -1, style=wx.SP_3D) self.dir = wx.GenericDirCtrl(splitter1, -1, dir='/home/', style=wx.DIRCTRL_DIR_ONLY) self.lc1 = wx.ListCtrl(splitter2, -1, style=wx.LC_LIST) self.lc2 = wx.ListCtrl(splitter2, -1, style=wx.LC_LIST) dt = MyTextDropTarget(self.lc2) self.lc2.SetDropTarget(dt) wx.EVT_LIST_BEGIN_DRAG(self, self.lc1.GetId(), self.OnDragInit) tree = self.dir.GetTreeCtrl() splitter2.SplitHorizontally(self.lc1, self.lc2) splitter1.SplitVertically(self.dir, splitter2) wx.EVT_TREE_SEL_CHANGED(self, tree.GetId(), self.OnSelect) self.OnSelect(0) self.Centre()
def Plugins(self, nom): self.panelPlugins= wx.Panel(self, -1) self.panels_buttons_plugins = wx.Panel(self.panelPlugins, -1) self.sizerPlugins = wx.BoxSizer(wx.VERTICAL) self.txtPlugin = wx.StaticText(self.panelPlugins, -1, _("Installed plugins"), size=wx.DefaultSize) self.txtPlugin.SetFont(self.fontTitle) self.pluginlist = wx.TreeCtrl(self.panelPlugins, 220, style=wx.RAISED_BORDER|wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT) self.pluginlist.SetSpacing(0) self.pluginImgList = wx.ImageList(16,16) self.pluginlist.SetImageList(self.pluginImgList) self.sizerPlugins.Add(self.txtPlugin, 1, wx.EXPAND|wx.ALL, 2) self.sizerPlugins.Add(self.pluginlist, 7, wx.EXPAND|wx.ALL, 2) self.sizerPlugins.Add(self.panels_buttons_plugins, 6, wx.EXPAND|wx.ALL, 2) self.panelPlugins.SetSizer(self.sizerPlugins) self.panelPlugins.SetAutoLayout(True) self.AddPlugin = wx.Button(self.panels_buttons_plugins, wx.ID_ADD, pos=(0,0)) self.DelPlugin = wx.Button(self.panels_buttons_plugins, wx.ID_REMOVE, pos=(100,0)) self.ConfigurePlugin = wx.Button(self.panels_buttons_plugins, 212, _("Configure"), pos=(0,38)) self.EnablePlugin = wx.Button(self.panels_buttons_plugins, 213, _("Enable"), pos=(100,38)) self.txtPlugin = wx.StaticText(self.panels_buttons_plugins, -1, _("Choose a plugin"), size=(300,150), pos=(200,5)) self.LoadPlugins() self.AddPage(self.panelPlugins, nom, imageId=5) wx.EVT_TREE_SEL_CHANGED(self, 220, self.choose_plugin) wx.EVT_BUTTON(self, 214, self.disable) wx.EVT_BUTTON(self, 213, self.enable) wx.EVT_BUTTON(self, 212, self.setup_plug) wx.EVT_BUTTON(self, wx.ID_REMOVE, self.delete_plug) wx.EVT_BUTTON(self, wx.ID_ADD, self.add_plug)
def init(self, parent): """ Finishes initializing the editor by creating the underlying toolkit widget. """ style = self.get_style() factory = self.factory if (len(factory.filter) > 0) or (factory.filter_name != ""): style |= wx.DIRCTRL_SHOW_FILTERS self.control = wx.GenericDirCtrl(parent, style=style) self._tree = tree = self.control.GetTreeCtrl() id = tree.GetId() wx.EVT_TREE_SEL_CHANGED(tree, id, self.update_object) wx.EVT_TREE_ITEM_ACTIVATED(tree, id, self._on_dclick) wx.EVT_TREE_ITEM_GETTOOLTIP(tree, id, self._on_tooltip) self.filter = factory.filter self.sync_value(factory.filter_name, "filter", "from", is_list=True) self.sync_value(factory.reload_name, "reload", "from") self.sync_value(factory.dclick_name, "dclick", "to") self.set_tooltip()
def Packages(self, nom): self.panelPackages = wx.Panel(self, -1) self.txtPackages = wx.StaticText(self.panelPackages, -1, _(nom), (10,10), wx.DefaultSize) self.txtPackages.SetFont(self.fontTitle) self.imagePackages = wx.ImageList(22, 22) self.desPackags = wx.StaticText(self.panelPackages, -1, _("Be careful! Installing one of these components can break your virtual drive."), (10,40), wx.DefaultSize) self.Menu = wx.TreeCtrl(self.panelPackages, 99, pos=(15,75),size=(530,260), style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|Variables.widget_borders) self.Menu.SetSpacing(0); self.Menu.SetImageList(self.imagePackages) self.imagePackages.RemoveAll() self.rootPackages = self.Menu.AddRoot("") self.i = 0 for app in self.packageList.getParsedList(): self.icon_look_for = Variables.playonlinux_rep+"/configurations/icones/"+self.packageList.getPackageFromName(app) if(os.path.exists(self.icon_look_for)): try: self.imagePackages.Add(wx.Bitmap(self.icon_look_for)) except: pass else: self.imagePackages.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux22.png")) self.Menu.AppendItem(self.rootPackages, app, self.i) self.i = self.i+1 self.PackageButton = wx.Button(self.panelPackages, 98, _("Install"), pos=(20+530-150,345), size=(150,30)) self.PackageButton.Disable() wx.EVT_TREE_SEL_CHANGED(self, 99, self.package_selected) wx.EVT_TREE_ITEM_ACTIVATED(self, 99, self.install_package) wx.EVT_BUTTON(self, 98, self.install_package) self.AddPage(self.panelPackages, nom)
def __init__(self, mainframe, *arg, **kw): wx.SplitterWindow.__init__(self, mainframe, *arg, **kw) tree = wx.TreeCtrl(self, -1) self.panel = wx.Panel(self, -1) items = [] item = item_root = tree.AddRoot('Configuration') items.append(item) def append_item(parent, name, data=None): item = tree.AppendItem(parent, name) tree.SetPyData(item, data) items.append(item) return item self.item_devices = append_item(item_root, 'Devices') append_item(item_root, 'Kernel image') append_item(item_root, 'Memory') append_item(item_root, 'Boot parameters') for item in items: tree.Expand(item) def sel_changed(event): clss = tree.GetPyData(event.GetItem()) if not clss: clss = OptionPanel instance = clss(self, mainframe) self.ReplaceWindow(self.panel, instance.panel) self.panel.Destroy() self.panel = instance.panel wx.EVT_TREE_SEL_CHANGED(tree, tree.GetId(), sel_changed) self.SplitVertically(tree, self.panel, 300) self.tree = tree self.mainframe = mainframe