def POL_SetupWindow_prefix_selector(self, message, title): self.Destroy_all() self.DrawDefault(message, title) self.add_games() self.MenuGames.Show() self.space = message.count("\\n") + 1 self.Menu.SetPosition((20, 85 + self.space * 16)) self.Menu.Clear() self.areaList = os.listdir(Variables.playonlinux_rep + "/wineprefix/") self.areaList.sort() for file in self.areaList: if (str(file[0]) == "."): self.areaList.remove(file) self.Menu.InsertItems(self.areaList, 0) self.Menu.Select(0) self.Menu.Hide() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menuprefixes) wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menuprefixes) wx.EVT_LISTBOX_DCLICK(self, 104, self.release_menuprefixes) self.PCheckBox.Show()
def __init__(self, parent, model): self.parent = parent self.model = model self.traduit = parent.traduit tID = wx.NewId() wx.Panel.__init__(self, parent, -1) self.tree = MyTreeCtrl(self, tID, wx.TR_HAS_BUTTONS) isz1 = (14, 14) isz2 = (10, 10) il = wx.ImageList(isz1[0], isz1[1]) foldrid = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz1)) foldropenid = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz1)) fileid = il.Add( wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz1)) chekid = il.Add( wx.ArtProvider_GetBitmap(wx.ART_TICK_MARK, wx.ART_MENU, isz1)) self.fileid = fileid self.chekid = chekid self.tree.SetImageList(il) self.il = il self.listItem = {} self.root = self.tree.AddRoot(self.traduit("VUE")) self.tree.SetPyData(self.root, None) self.tree.SetItemImage(self.root, foldrid, wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, foldropenid, wx.TreeItemIcon_Expanded) self.groupeTrad = [] # liste des groupes traduite self.itemTrad = [[], []] # liste des items francais et traduits for groupe in self.getGlistK(): self.groupeTrad.append(self.traduit(groupe)) child = self.tree.AppendItem(self.root, self.traduit(groupe)) self.tree.SetPyData(child, None) self.tree.SetItemImage(child, foldrid, wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, foldropenid, wx.TreeItemIcon_Expanded) if groupe == '4.Organiques': self.treeRorg = child if groupe == '5.A_electrons': self.treeRmin = child if groupe == '6.rt3d': self.treeRt3d = child if groupe == '7.pht3d': self.treePht3d = child if groupe == '8.reactionIsot': self.treeRisot = child for item in self.model.getGlist()[groupe]: self.itemTrad[0].append(item) self.itemTrad[1].append(self.traduit(item)) last = self.tree.AppendItem(child, self.traduit(item)) self.tree.SetPyData(last, None) #self.modelGetData(item)) self.listItem[item] = [groupe, last] self.tree.Expand(self.root) self.tree.SortChildren(self.root) wx.EVT_TREE_ITEM_RIGHT_CLICK(self, tID, self.OnSelRClick) wx.EVT_TREE_ITEM_ACTIVATED(self, tID, self.OnActivate)
def __init__(self, parent, id, size=wx.DefaultSize, pos=wx.DefaultPosition, style=None, configSources=None, rootLabel="", paramWidgets=None): """Set up our specialised tree.""" self.paramTextCtrl = paramWidgets[0] self.paramDescription = paramWidgets[1] self.mConfSources = configSources for src in configSources: _log.debug('config source: [%s]' % str(src)) self.rootLabel = rootLabel wx.TreeCtrl.__init__(self, parent, id, pos, size, style) self.root = None self.param_list = None # currently selected parameter/subtree self.currSelParam = None self.currSelSubtree = None # connect handler wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnActivate) wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
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 __build(self): """ Construct the GUI. """ sizer = wx.BoxSizer(wx.HORIZONTAL) nb = self.notebook = wx.Notebook(self, -1) sizer.Add(nb, 1, wx.EXPAND) #self.htmlWindow = wx.HtmlWindow(nb, -1) self.text = wx.TextCtrl(nb, -1, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_LINEWRAP | wx.TE_RICH) nb.AddPage(self.text, "General") self.tree = wx.TreeCtrl(nb, -1, style=wx.TR_NO_BUTTONS | wx.TR_SINGLE) nb.AddPage(self.tree, "Certification path") # # Force the tree to stay open. # wx.EVT_TREE_ITEM_COLLAPSING(self, self.tree.GetId(), lambda event: event.Veto()) wx.EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.OnTreeItemActivated) self.SetSizer(sizer) self.SetAutoLayout(1) self.Fit()
def __init__(self, parent, ID, image_display): wx.GenericDirCtrl.__init__( self, parent, ID, filter="All files (*.*)|*.*|TIFF files (*.tiff,*.tif)|*.tiff,*.tif", style=wx.DIRCTRL_SHOW_FILTERS) # self.SetDefaultPath(config.options.file.default_directory) wx.EVT_TREE_ITEM_ACTIVATED(self.GetTreeCtrl(), -1, self.OnItemSelected) self.image_display = image_display
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 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 __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, toplevel, parent): self.toplevel = toplevel self.modules = [] self.undo_history = [] self.added = [] self.removed = [] id = wx.NewId() wx.TreeCtrl.__init__(self, parent, id) self.root = self.AddRoot("RuleSets") self.SetItemHasChildren(self.root, True) self.SetPyData(self.root, "") wx.EVT_TREE_ITEM_ACTIVATED(self, id, self._OnActivated) self.Expand(self.root)
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 POL_SetupWindow_shortcut_list(self, message, title): self.Destroy_all() self.DrawDefault(message, title) self.add_games() self.space = message.count("\\n") + 1 self.MenuGames.SetPosition((20, 85 + self.space * 16)) self.MenuGames.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame) wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menugame)
def POL_SetupWindow_icon_menu(self, message, title, items, cut, icon_folder, icon_list): self.Destroy_all() self.DrawDefault(message, title) self.add_menu_icons(items, cut, icon_list, icon_folder); self.space = message.count("\\n")+1 self.MenuGames.SetPosition((20,85+self.space*16)) self.MenuGames.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame) wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menugame)
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)
class MyPage(object): def __init__(self, parent, ID): parent.GetParent().SetStatusText('Loading %s' % typenames[ID]) self.Window = wx.Window(parent, ID) self.Window.MyPage = self # set back reference parent.AddPage(self.Window, typenames[ID]) self.struct = structs[typenames[ID] + 'Data'] self.ID = ID self.ids = [] self.data = {} self.ObjID = -1 self.findpos_i = 0 self.findpos_j = -1 self.SplitterWindow = ProportionalSplitter(self.Window, -1, 0.3, size=(600, 600)) self.Tree = wx.TreeCtrl(self.SplitterWindow, -1) self.ListBoxWnd = ProportionalSplitter(self.SplitterWindow, -1, 0.9) self.ListBox = wx.ListBox(self.ListBoxWnd, -1, choices=self.ids) self.ButtonPane = wx.Panel(self.ListBoxWnd, -1) self.AddButton = wx.Button(self.ButtonPane, -1, "Add") self.DupButton = wx.Button(self.ButtonPane, -1, "Duplicate") self.DelButton = wx.Button(self.ButtonPane, -1, "Delete") self.BoxSizer = wx.BoxSizer(wx.HORIZONTAL) self.BoxSizer.Add(self.AddButton, 1, wx.EXPAND) self.BoxSizer.Add(self.DupButton, 1, wx.EXPAND) self.BoxSizer.Add(self.DelButton, 1, wx.EXPAND) self.ButtonPane.SetSizer(self.BoxSizer) self.SplitterWindow.SplitVertically(self.ListBoxWnd, self.Tree) self.ListBoxWnd.SplitHorizontally(self.ListBox, self.ButtonPane) try: self.LoadTHD(file("obj%02i.thd" % ID, "rb")) except IOError: pass except Exception, detail: print "ID %i [%s]: " % (ID, typenames[ID]) + str(detail) self.RedrawTree() wx.EVT_TREE_ITEM_ACTIVATED(self.Window, self.Tree.GetId(), self.EditTreeItem) wx.EVT_LISTBOX(self.Window, self.ListBox.GetId(), self.SelectID) wx.EVT_BUTTON(self.Window, self.AddButton.GetId(), self.AddItem) wx.EVT_BUTTON(self.Window, self.DelButton.GetId(), self.DelItem) wx.EVT_BUTTON(self.Window, self.DupButton.GetId(), self.DupItem) return 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): """ 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, parent, id, style): wx.TreeCtrl.__init__(self, parent, id, style=style) iconList = wx.ImageList(16, 16, -1) wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.ExpandDir) wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.ExpandDir) folder_bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_CMN_DIALOG, (16, 16)) self._folderClosedIconIndex = iconList.Add(folder_bmp) folder_open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_CMN_DIALOG, (16, 16)) self._folderOpenIconIndex = iconList.Add(folder_open_bmp) file_bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_CMN_DIALOG, (16, 16)) self._fileIconIndex = iconList.Add(file_bmp) exe_bmp = wx.ArtProvider.GetBitmap(wx.ART_EXECUTABLE_FILE, wx.ART_CMN_DIALOG, (16, 16)) self._exeIconIndex = iconList.Add(exe_bmp) self._fileIconIndexLookup = {} #self.Bind(wx.EVT_TREE_ITEM_EXPANDING,self.ExpandDir) #self.Bind(wx.EVT_TREE_ITEM_ACTIVATED,self.ExpandDir) self.AssignImageList(iconList)
def __init__(self, parent, editor, autoexpand=True): self.initmixin() wx.Panel.__init__(self, parent, -1) self.parent = parent self.editor = editor self.autoexpand = autoexpand self.activeflag = False self.sizer = ui.VBox(namebinding='widget').create(self).auto_layout() self.btnRefresh = FlatButtons.FlatBitmapButton( self, -1, common.getpngimage('images/classbrowserrefresh.gif')) self.sizer.add(self.btnRefresh).bind('click', self.OnRefresh) self.imagelist = wx.ImageList(16, 16) #add share image list self.imagefilenames = [] self.imageids = {} self.callplugin('add_images', self.imagefilenames) for name, imagefile in self.imagefilenames: self.add_image(name, imagefile) style = wx.TR_SINGLE | wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS | wx.TR_TWIST_BUTTONS if wx.Platform == '__WXMSW__': style = style | wx.TR_ROW_LINES elif wx.Platform == '__WXGTK__': style = style | wx.TR_NO_LINES self.tree = wx.TreeCtrl(self, -1, style=style) self.tree.AssignImageList(self.imagelist) self.sizer.add(self.tree, proportion=1, flag=wx.EXPAND) self.root = self.tree.AddRoot('OutlineBrowser') self.nodes = {} self.ID = 1 # 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.OnChanged) # 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) wx.EVT_LEFT_DOWN(self.tree, self.OnLeftDown) wx.EVT_TREE_ITEM_GETTOOLTIP(self.tree, self.tree.GetId(), self.OnGetToolTip) wx.EVT_LEFT_DCLICK(self.tree, self.OnDoubleClick) self.tooltip_func = None #add init process self.callplugin('init', self) # self.SetSizer(self.sizer) # self.SetAutoLayout(True) self.sizer.auto_fit(0) self.popmenus = None
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size=(792, 593), style=wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.panelFenp = wx.Panel(self, -1) self.live = 0 self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.images_cat = wx.ImageList(22, 22) self.imagesapps = wx.ImageList(22, 22) self.list_cat = wx.TreeCtrl(self.panelFenp, 105, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER, size=(200, 363), pos=(10, 10)) self.image = wx.StaticBitmap( self.panelFenp, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/pol_min.png"), (10, 383), wx.DefaultSize) self.list_cat.SetSpacing(0) self.list_cat.SetImageList(self.images_cat) self.AddCats() self.searchbox = wx.TextCtrl(self.panelFenp, 110, size=(364, 25), pos=(319, 9)) self.searchcaption = wx.StaticText(self.panelFenp, -1, _("Search: "), (220, 15), wx.DefaultSize) self.lasthtml_content = "" self.list_apps = wx.TreeCtrl(self.panelFenp, 106, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER, size=(562, 261), pos=(220, 40)) self.list_apps.SetImageList(self.imagesapps) self.list_apps.SetSpacing(0) self.stars = 0 self.content = wx.html.HtmlWindow(self.panelFenp, 107, style=wx.RAISED_BORDER, pos=(220, 311), size=(562, 222)) self.button = wx.Button(self.panelFenp, wx.ID_CLOSE, pos=(576, 545), size=(100, 35)) self.install_button = wx.Button(self.panelFenp, wx.ID_APPLY, pos=(683, 545), size=(100, 35)) self.update_button = wx.Button(self.panelFenp, wx.ID_REFRESH, pos=(470, 545), size=(100, 35)) self.install_button.Enable(False) self.new_panel = wx.Panel(self.panelFenp, -1, pos=(220, 311), style=wx.RAISED_BORDER, size=(562, 222)) self.new_panel.SetBackgroundColour((255, 255, 255)) self.animation = wx.animate.GIFAnimationCtrl( self.new_panel, -1, Variables.playonlinux_env + "/etc/24-0.gif", (271, 86)) self.animation.Play() self.new_panel.Hide() self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) self.timer.Start(200) #self.ManualInstall = wx.CheckBox(self.panelFenp, 111, label=_("Install a .pol package or an unsupported application"), pos=(10,530)) self.ManualInstall = wx.HyperlinkCtrl( self.panelFenp, 111, _("Install a .pol package or an unsupported application"), "", pos=(10, 565)) self.ManualInstall.SetNormalColour(wx.Colour(0, 0, 0)) # self.AddApps() 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_TREE_ITEM_ACTIVATED(self, 106, self.installapp) wx.EVT_TEXT(self, 110, self.search) wx.EVT_HYPERLINK(self, 111, self.manual)
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size=(800, 550 + Variables.windows_add_size), style=wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.cats_icons = {} self.cats_links = {} self.description = getDescription() self.panelFenp = wx.Panel(self, -1) self.panelItems = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait.Hide() self.panelManual = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelManual.Hide() self.currentPanel = 0 # [ 1 = manual, 0 = items ] # Categories self.panelButton = wx.Panel(self.panelFenp, -1, size=(802, 69), pos=(-1, -1), style=Variables.widget_borders) self.panelButton.SetBackgroundColour((255, 255, 255)) if (os.environ["POL_OS"] == "Mac"): self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) else: self.fontText = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.addCat( _("Accessories"), Variables.playonlinux_env + "/resources/images/install/32/applications-accessories.png", 0) self.addCat( _("Development"), Variables.playonlinux_env + "/resources/images/install/32/applications-development.png", 1) self.addCat( _("Education"), Variables.playonlinux_env + "/resources/images/install/32/applications-science.png", 2) self.addCat( _("Games"), Variables.playonlinux_env + "/resources/images/install/32/applications-games.png", 3) self.addCat( _("Graphics"), Variables.playonlinux_env + "/resources/images/install/32/applications-graphics.png", 4) self.addCat( _("Internet"), Variables.playonlinux_env + "/resources/images/install/32/applications-internet.png", 5) self.addCat( _("Multimedia"), Variables.playonlinux_env + "/resources/images/install/32/applications-multimedia.png", 6) self.addCat( _("Office"), Variables.playonlinux_env + "/resources/images/install/32/applications-office.png", 7) self.addCat( _("Other"), Variables.playonlinux_env + "/resources/images/install/32/applications-other.png", 8) self.addCat( _("Patches"), Variables.playonlinux_env + "/resources/images/install/32/view-refresh.png", 9) self.live = 0 self.openMin = False self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.images_cat = wx.ImageList(22, 22) self.imagesapps = wx.ImageList(22, 22) #self.list_cat = wx.TreeCtrl(self.panelItems, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|Variables.widget_borders, size=(200, 363), pos=(10,10)) #self.list_cat.Hide() if (os.environ["POL_OS"] == "Mac"): self.image_position = (738 - 160, 346 - 71) self.new_size = (196, 218 - 4) self.search_offset = 3 if (os.environ["POL_OS"] == "Linux"): self.image_position = (740 - 160, 348 - 71) self.new_size = (200, 222 - 4) self.search_offset = 5 self.image = wx.StaticBitmap( self.panelItems, 108, wx.Bitmap(Variables.playonlinux_env + "/resources/images/pol_min.png"), self.image_position, wx.DefaultSize) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) #self.list_cat.SetSpacing(0); #self.list_cat.SetImageList(self.images_cat) position = 10 + self.search_offset #self.searchcaption = wx.StaticText(self.panelItems, -1, _("Search"), (position,82-71+self.search_offset), wx.DefaultSize) #position += self.searchcaption.GetSize()[0]+5 self.searchbox = wx.SearchCtrl(self.panelItems, 110, size=(250, 22), pos=(position, 9)) self.searchbox.SetDescriptiveText(_("Search")) position += self.searchbox.GetSize()[0] + 20 self.filterscaption = wx.StaticText( self.panelItems, -1, _("Include:"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.filterscaption.GetSize()[0] + 10 self.testingChk = wx.CheckBox(self.panelItems, 401, pos=(position, 82 - 71), size=wx.DefaultSize) self.testingChk.SetValue(True) position += 15 + self.search_offset self.testingCapt = wx.StaticText( self.panelItems, -1, _("Testing"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.testingCapt.GetSize()[0] + 10 self.nocdChk = wx.CheckBox(self.panelItems, 402, pos=(position, 82 - 71), size=wx.DefaultSize) position += 15 + self.search_offset self.noDvDCapt = wx.StaticText( self.panelItems, -1, _("No-cd needed"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.noDvDCapt.GetSize()[0] + 10 self.freeChk = wx.CheckBox(self.panelItems, 403, pos=(position, 82 - 71), size=wx.DefaultSize) self.freeChk.SetValue(True) position += 15 + self.search_offset self.FreeCapt = wx.StaticText(self.panelItems, -1, _("Commercial"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.FreeCapt.GetSize()[0] + 10 self.star_x = position self.lasthtml_content = "" self.list_apps = wx.TreeCtrl(self.panelItems, 106, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders, size=(550, 385), pos=(15, 113 - 71)) self.list_apps.SetImageList(self.imagesapps) self.list_apps.SetSpacing(0) self.stars = 0 #self.content = wx.TextCtrl(self.panelItems, 107, pos=(220,301), size=(562,212), style = wx.TE_MULTILINE | wx.TE_RICH2 | wx.CB_READONLY | Variables.widget_borders) self.content = PyClickableHtmlWindow(self.panelItems, 107, style=Variables.widget_borders, pos=(580, 113 - 71), size=(200, 218)) self.button = wx.Button(self.panelItems, wx.ID_CLOSE, _("Cancel"), pos=(736 - 160, 510 - 71), size=(100, 35)) self.install_button = wx.Button(self.panelItems, wx.ID_APPLY, _("Install"), pos=(843 - 160, 510 - 71), size=(100, 35)) self.update_button = wx.Button(self.panelItems, wx.ID_REFRESH, _("Refresh"), pos=(630 - 160, 510 - 71), size=(100, 35)) self.install_button.Enable(False) self.new_panel = wx.Panel(self.panelItems, -1, pos=(740 - 160, 113 - 71), style=Variables.widget_borders, size=self.new_size) self.new_panel.SetBackgroundColour((255, 255, 255)) self.animation = wx.animate.GIFAnimationCtrl( self.new_panel, -1, Variables.playonlinux_env + "/resources/images/install/wait_mini.gif", (90, 100)) self.animation.Hide() self.new_panel.Hide() self.ManualInstall = wx.HyperlinkCtrl( self.panelItems, 111, _("Install a non-listed program"), "", pos=(10, 515 - 71)) self.ManualInstall.SetNormalColour(wx.Colour(0, 0, 0)) # Panel wait self.animation_wait = wx.animate.GIFAnimationCtrl( self.panelWait, -1, Variables.playonlinux_env + "/resources/images/install/wait.gif", ((800 - 128) / 2, (550 - 128) / 2 - 71)) self.percentageText = wx.StaticText(self.panelWait, -1, "", ((800 - 30) / 2, (550 - 128) / 2 + 128 + 10 - 71), wx.DefaultSize) self.percentageText.SetFont(self.fontTitre) self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) self.timer.Start(200) # panel manual # self.AddApps() #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.EVT_HYPERLINK(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, renwin, objs=None): """Constructor of the vtkPipelineBrowser. If objs == None, this class assumes that you want a full pipeline which it will extract starting at the renwin. If you have some vtk objects however, this class will act as a segment browser with those objects as the root nodes. In the latter case, the renwin will still be used for performing updates. """ self.renwin = renwin self._objs = objs # this will be a dictionary of already existing ConfigVtkObj's using # the vtk_obj as key... this is to enable us to lookup already running # instances and just reactivate them self._config_vtk_objs = {} self._frame = wx.Frame(parent=parent, id=-1, title="VTK Pipeline Browser") wx.EVT_CLOSE(self._frame, lambda e: self.hide()) panel = wx.Panel(parent=self._frame, id=-1) tree_id = wx.NewId() self._tree_ctrl = wx.TreeCtrl(parent=panel, id=tree_id, size=wx.Size(300, 400), style=wx.TR_HAS_BUTTONS) wx.EVT_TREE_ITEM_ACTIVATED(panel, tree_id, self.item_activate_cb) button_sizer = wx.BoxSizer(wx.HORIZONTAL) refr_id = wx.NewId() refr = wx.Button(parent=panel, id=refr_id, label="Refresh") wx.EVT_BUTTON(panel, refr_id, self.refresh) button_sizer.Add(refr) q_id = wx.NewId() q = wx.Button(parent=panel, id=q_id, label="Close") wx.EVT_BUTTON(panel, q_id, lambda e, s=self: s.hide()) button_sizer.Add(q) top_sizer = wx.BoxSizer(wx.VERTICAL) top_sizer.Add(self._tree_ctrl, proportion=1, flag=wx.EXPAND) top_sizer.Add(button_sizer, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL) panel.SetAutoLayout(True) panel.SetSizer(top_sizer) top_sizer.Fit(self._frame) top_sizer.SetSizeHints(self._frame) #self._frame.Show(True) ICONDIR = "Icons" # Look for Icons subdirectory in the same directory as this module try: # handling frozen installs. home, exe = os.path.split(sys.executable) if string.lower(exe[:6]) == 'python': _icondir = os.path.join(os.path.dirname(__file__), ICONDIR) else: # frozen (added by Prabhu, I think?) _icondir = os.path.join(home, ICONDIR) except NameError: # this probably means that __file__ didn't exist, and that # we're being run directly, in which case we have to use # argv[0] and ICONDIR to find the real icondir _icondir = os.path.join(os.path.dirname(sys.argv[0]), ICONDIR) if os.path.isdir(_icondir): ICONDIR = _icondir elif not os.path.isdir(ICONDIR): raise RuntimeError, "can't find icon directory (%s)" % ` ICONDIR ` self._image_list = wx.ImageList(16, 16) for i in icon_map.values(): self._image_list.Add( wx.Bitmap(os.path.join(ICONDIR, i + ".xpm"), wx.BITMAP_TYPE_XPM)) self._tree_ctrl.SetImageList(self._image_list) # do initial population of tree self.refresh()
def Init(self, res): """Method called after the panel has been initialized.""" # Set window icon if not guiutil.IsMac(): self.SetIcon(guiutil.get_icon()) # Initialize controls self.txtDicomImport = XRCCTRL(self, 'txtDicomImport') self.btnDicomImport = XRCCTRL(self, 'btnDicomImport') self.checkSearchSubfolders = XRCCTRL(self, 'checkSearchSubfolders') self.lblDirections = XRCCTRL(self, 'lblDirections') self.lblDirections2 = XRCCTRL(self, 'lblDirections2') self.lblProgressLabel = XRCCTRL(self, 'lblProgressLabel') self.lblProgress = XRCCTRL(self, 'lblProgress') self.gaugeProgress = XRCCTRL(self, 'gaugeProgress') self.lblProgressPercent = XRCCTRL(self, 'lblProgressPercent') self.lblProgressPercentSym = XRCCTRL(self, 'lblProgressPercentSym') self.tcPatients = XRCCTRL(self, 'tcPatients') self.bmpRxDose = XRCCTRL(self, 'bmpRxDose') self.lblRxDose = XRCCTRL(self, 'lblRxDose') self.txtRxDose = XRCCTRL(self, 'txtRxDose') self.lblRxDoseUnits = XRCCTRL(self, 'lblRxDoseUnits') self.btnSelect = XRCCTRL(self, 'wxID_OK') # Bind interface events to the proper methods wx.EVT_BUTTON(self, XRCID('btnDicomImport'), self.OnBrowseDicomImport) wx.EVT_CHECKBOX(self, XRCID('checkSearchSubfolders'), self.OnCheckSearchSubfolders) wx.EVT_TREE_SEL_CHANGED(self, XRCID('tcPatients'), self.OnSelectTreeItem) wx.EVT_TREE_ITEM_ACTIVATED(self, XRCID('tcPatients'), self.OnOK) wx.EVT_BUTTON(self, wx.ID_OK, self.OnOK) wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) # Set the dialog font and bold the font of the directions label font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if guiutil.IsMac(): self.txtDicomImport.SetFont(font) self.btnDicomImport.SetFont(font) self.checkSearchSubfolders.SetFont(font) self.lblDirections.SetFont(font) self.lblDirections2.SetFont(font) self.lblProgressLabel.SetFont(font) self.lblProgress.SetFont(font) self.lblProgressPercent.SetFont(font) self.lblProgressPercentSym.SetFont(font) self.tcPatients.SetFont(font) self.txtRxDose.SetFont(font) self.lblRxDoseUnits.SetFont(font) font.SetWeight(wx.FONTWEIGHT_BOLD) self.lblDirections2.SetFont(font) self.lblRxDose.SetFont(font) # Initialize the patients tree control self.root = self.InitTree() # Initialize the patients dictionary self.patients = {} # Initialize the import location via pubsub pub.subscribe(self.OnImportPrefsChange, 'general.dicom') pub.sendMessage('preferences.requested.values', 'general.dicom') # Search subfolders by default self.import_search_subfolders = True # Set the threading termination status to false intially self.terminate = False # Hide the progress bar until it needs to be shown self.gaugeProgress.Show(False) self.lblProgressPercent.Show(False) self.lblProgressPercentSym.Show(False) # Start the directory search as soon as the panel loads self.OnDirectorySearch()
def __init__(self, title): wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(480, 480)) self.CreateStatusBar(1, 0, 0, "") self.running = None self.results = [] ##self.SetIcon(wx.Icon("icons/icon32x16b.xpm", wx.BITMAP_TYPE_XPM)) menu = wx.Menu() menu.Append(ID_LOAD, "&Load...\tCtrl+L") menubar = wx.MenuBar() menubar.Append(menu, "&Commands") self.menuTests = wx.Menu() self.menuTests.Append(ID_START, "Run\tF5") self.menuTests.Append(ID_STOP, "Stop") self.menuTests.Append(ID_CLEAR, "Clear") menubar.Append(self.menuTests, "&Tests") menuView = wx.Menu() menuView.AppendCheckItem(ID_TB, "Toolbar") menuView.Check(ID_TB, True) menubar.Append(menuView, "&View") menuHelp = wx.Menu() menuHelp.Append(wx.ID_HELP, "Manual\tF1") menuHelp.Append(ID_ABOUT, "&About...") menubar.Append(menuHelp, "&Help") self.SetMenuBar(menubar) tb = wx.ToolBar(self, -1, style=wx.TB_FLAT) tb.SetToolBitmapSize((22, 22)) tb.AddTool(ID_START, ICON_OK) tb.AddTool(ID_STOP, ICON_NOK) tb.AddTool(ID_CLEAR, ICON_DEFAULT) self.tb = tb tb.Realize() self.SetMode(False) splitter = wx.SplitterWindow(self, -1, style=0) self.tree = wx.TreeCtrl(splitter, style=wx.TR_HAS_BUTTONS | wx.TR_LINES_AT_ROOT) self.textCtrl = wx.TextCtrl(splitter, style=wx.TE_MULTILINE) splitter.SplitHorizontally(self.tree, self.textCtrl) splitter.SetMinimumPaneSize(40) splitter.SetSashPosition(250, True) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) sizer.Add(splitter, 1, wx.EXPAND) self.SetSizer(sizer) self.imageList = wx.ImageList(22, 22) self.IM_OK = self.imageList.Add(ICON_OK) self.IM_NOK = self.imageList.Add(ICON_NOK) self.IM_DEFAULT = self.imageList.Add(ICON_DEFAULT) self.tree.SetImageList(self.imageList) wx.EVT_MENU(self, ID_LOAD, self.OnLoad) wx.EVT_MENU(self, ID_ABOUT, self.OnAbout) wx.EVT_MENU(self, ID_TB, self.OnTB) wx.EVT_CLOSE(self, self.OnExit) wx.EVT_TREE_ITEM_ACTIVATED(self, wx.ID_ANY, self.OnActivate) self.Bind(wx.EVT_TOOL, self.OnStart, id=ID_START) self.Bind(wx.EVT_TOOL, self.OnStopRequest, id=ID_STOP) self.Bind(wx.EVT_TOOL, self.OnClear, id=ID_CLEAR) self.Bind(EVT_TESTRESULT, self.OnTestResult) self.Bind(EVT_STOP, self.OnStop) self.Bind(EVT_ITEMTEXT, self.OnItemText) self.Bind(EVT_CONSOLE, self.OnConsole) if options and options.run: self.Load() self.OnStart()
def __init__(self, parent, mainframe, dirs=None): self.initmixin() wx.Panel.__init__(self, parent, -1) self.parent = parent self.mainframe = mainframe self.pref = mainframe.pref self.sizer = wx.BoxSizer(wx.VERTICAL) imagelist = mainframe.dirbrowser_imagelist self.dirbrowserimagelist = wx.ImageList(16, 16) self.close_image = self.add_image( common.getpngimage(imagelist['close'])) self.open_image = self.add_image(common.getpngimage(imagelist['open'])) self.item_image = self.add_image(common.getpngimage(imagelist['item'])) self.deal_file_images() style = wx.TR_EDIT_LABELS | wx.TR_SINGLE | wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS | wx.TR_TWIST_BUTTONS if wx.Platform == '__WXMSW__': style = style | wx.TR_ROW_LINES elif wx.Platform == '__WXGTK__': style = style | wx.TR_NO_LINES self.tree = wx.TreeCtrl(self, -1, style=style) self.tree.SetImageList(self.dirbrowserimagelist) self.sizer.Add(self.tree, 1, wx.EXPAND) self.root = self.tree.AddRoot('DirBrowser') #add drop target self.SetDropTarget(MyFileDropTarget(self)) # 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_RIGHT_DOWN(self.tree, self.OnRightDown) 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) wx.EVT_KEY_DOWN(self.tree, self.OnKeyDown) wx.EVT_CHAR(self.tree, self.OnChar) self.SetSizer(self.sizer) self.SetAutoLayout(True) self.nodes = {} self.ID = 1 self.cache = None #@add_project self.callplugin_once('add_project', DirBrowser.project_names) pop_menus = copy.deepcopy(DirBrowser.popmenulist) self.popmenus = makemenu.makepopmenu(self, pop_menus) self.dirmenu_ids = [self.IDPM_ADD_DIRS] wx.EVT_UPDATE_UI(self, self.IDPM_CUT, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_COPY, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_PASTE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_CLOSE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_ADDFILE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_ADDPATH, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_DELETE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_REFRESH, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_RENAME, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_IGNORETHIS, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_IGNORETHISTYPE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_OPENDEFAULT, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_SETPROJ, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_COMMANDLINE, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.IDPM_PRINTDIR, self.OnUpdateUI) self.popmenus = None if dirs: for i in dirs: self.addpath(i, False) self.callplugin('init', self)
def AjouteIRC(self, nom): self.panel = wx.Panel(self, -1) self.panels_button = wx.Panel(self.panel, -1) self.panels_main = wx.Panel(self.panel, -1) self.panels_connexion = wx.Panel(self.panel, -1) #self.content = wx.TextCtrl(self.panel, 107, pos=(0,20), size=(500,300), style = wx.TE_MULTILINE | wx.TE_RICH2 | wx.CB_READONLY | wx.RAISED_BORDER) self.content = wx.html.HtmlWindow(self.panels_main, -1, style=wx.RAISED_BORDER) self.buddy = wx.TreeCtrl(self.panels_main, 126, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER) self.buddy.SetSpacing(0) self.window = wx.TreeCtrl(self.panels_main, 127, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER) #self.root_window = self.window.AddRoot("") self.window.SetSpacing(0) self.buddy_images = wx.ImageList(16, 16) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/star.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/h-star.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux16.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/spacer16.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/star.png")) self.buddy.SetImageList(self.buddy_images) self.window_images = wx.ImageList(16, 16) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/internet-group-chat.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/system-users.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/applications-system.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux16.png")) self.window.SetImageList(self.window_images) self.buddy.SetSpacing(0) self.field = wx.TextCtrl(self.panels_button, 121, style=wx.TE_MULTILINE) self.button = wx.Button(self.panels_button, 122, _("Send")) self.connect = wx.Button(self.panels_connexion, 123, _("Connect"), pos=(0, 0), size=(100, 28)) self.disconnect = wx.Button(self.panels_connexion, 124, _("Disconnect"), pos=(100, 0), size=(100, 28)) #self.close = wx.Button(self.panels_connexion, 128, _("Close"), pos=(600,0), size=(90,25)) self.close = wx.BitmapButton( self.panels_connexion, 128, wx.Bitmap(Variables.playonlinux_env + "/resources/images/menu/wineserver.png"), pos=(520, 0)) self.settings = self.getSettings() self.nickname = wx.TextCtrl(self.panels_connexion, 125, self.settings["NICKNAME"], size=(300, 25), pos=(210, 2)) #self.channel_choices = ["#playonlinux-fr","#playonlinux-en","#playonlinux-it","#playonlinux-ru","#playonlinux-pl","#playonlinux-hu","#playonlinux-es"] #self.channel_choices.sort() #self.channel = wx.ComboBox(self.panels_connexion, 130, _("Join a channel"), size=(190,28), pos=(510,0), choices=self.channel_choices) # self.close.Enable(False) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizerInputs = wx.BoxSizer(wx.HORIZONTAL) self.sizerMain = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.panels_connexion, 3, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.panels_main, 36, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.panels_button, 4, wx.EXPAND | wx.ALL, 2) self.sizerInputs.Add(self.field, 14, wx.EXPAND | wx.ALL, 2) self.sizerInputs.Add(self.button, 4, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.window, 4, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.content, 10, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.buddy, 4, wx.EXPAND | wx.ALL, 2) self.panel.SetSizer(self.sizer) self.panels_button.SetSizer(self.sizerInputs) self.panels_main.SetSizer(self.sizerMain) self.panel.SetAutoLayout(True) self.AddPage(self.panel, nom) self.field.Bind(wx.EVT_KEY_UP, self.EventKey) self.nickname.Bind(wx.EVT_KEY_UP, self.NicknameKey) #self.channel.Bind(wx.EVT_KEY_UP, self.EventChannel) wx.EVT_COMBOBOX(self, 130, self.JoinChan) wx.EVT_BUTTON(self, 122, self.EventButton) wx.EVT_BUTTON(self, 123, self.EventStart) wx.EVT_BUTTON(self, 124, self.EventStop) wx.EVT_BUTTON(self, 128, self.EventClose) wx.EVT_TREE_ITEM_ACTIVATED(self, 126, self.AddNick)
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size=(600, 565)) self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.timer = wx.Timer(self, 1) self.images = wx.ImageList(32, 32) if (len(sys.argv) > 1): self.panel_games = wx.Panel(self, -1) self.panel_update = wx.Panel(self.panel_games, -1) #self.panel_update.SetBackgroundColour((255,255,225)) self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) #argv[1] = 1 nvversion -- argv[2] = version #argv[1] = 2 no net #argv[1] = 3 version de dev #argv[1] = 4 unofficial website used if (int(sys.argv[1]) == 1): self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap( "gtk-refresh", wx.ART_MENU), pos=(15, 0)) self.texte_update = wx.StaticText( self.panel_update, -1, _("An updated version of PlayOnLinux is available.") + " (" + sys.argv[2] + ")", pos=(35, 0)) elif (int(sys.argv[1]) == 2): self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap( "gtk-dialog-warning", wx.ART_MENU), pos=(15, 0)) self.texte_update = wx.StaticText( self.panel_update, -1, _("You do not seem to be connected to the Internet."), pos=(35, 0)) self.texte_update.SetForegroundColour("red") elif (int(sys.argv[1]) == 3): self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap( "gtk-dialog-warning", wx.ART_MENU), pos=(15, 0)) self.texte_update = wx.StaticText( self.panel_update, -1, _("Your are using a development version, be careful."), pos=(35, 0)) self.texte_update.SetForegroundColour("orange") elif (int(sys.argv[1]) == 4): self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap( "gtk-dialog-warning", wx.ART_MENU), pos=(15, 0)) self.texte_update = wx.StaticText( self.panel_update, -1, _("You seem to be using the Offline PlayOnLinux plugin."), pos=(35, 0)) self.texte_update.SetForegroundColour("green") else: self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap( "gtk-dialog-error", wx.ART_MENU), pos=(15, 0)) self.texte_update = wx.StaticText( self.panel_update, -1, _("Internal error when starting GUI. Please file a bug report ASAP!" ), pos=(35, 0)) self.texte_update.SetFont(self.fontText) self.list_game = wx.TreeCtrl(self.panel_games, 105, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) self.sizer_games = wx.BoxSizer(wx.VERTICAL) self.sizer_games.Add(self.panel_update, 1, wx.EXPAND | wx.ALL, 2) self.sizer_games.Add(self.list_game, 20, wx.EXPAND | wx.ALL, 2) self.panel_games.SetSizer(self.sizer_games) self.panel_games.SetAutoLayout(True) else: self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) self.list_game.SetSpacing(0) self.list_game.SetImageList(self.images) self.oldreload = "" self.oldimg = "" self.filemenu = wx.Menu() self.filemenu.Append(wx.ID_OPEN, _("Run")) self.filemenu.Append(wx.ID_ADD, _("Install")) self.filemenu.Append(wx.ID_DELETE, _("Remove")) self.filemenu.Append(wx.ID_REFRESH, _("Refresh the repository")) self.filemenu.AppendSeparator() self.filemenu.Append(wx.ID_EXIT, _("Exit")) self.expertmenu = wx.Menu() self.winever_item = wx.MenuItem(self.expertmenu, 107, _("Manage Wine versions")) self.winever_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/menu/wine.png")) self.expertmenu.AppendItem(self.winever_item) #self.wineserv_item = wx.MenuItem(self.expertmenu, 115, _("Kill wineserver process")) #self.wineserv_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/wineserver.png")) #self.expertmenu.AppendItem(self.wineserv_item) self.run_item = wx.MenuItem(self.expertmenu, 108, _("Run a local script")) self.run_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/menu/run.png")) self.expertmenu.AppendItem(self.run_item) self.polshell_item = wx.MenuItem(self.expertmenu, 109, _("PlayOnLinux debugger")) self.polshell_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/menu/polshell.png")) self.expertmenu.AppendItem(self.polshell_item) self.cdrom_item = wx.MenuItem(self.expertmenu, 120, _("Autorun")) self.cdrom_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/menu/cdrom.png")) self.expertmenu.AppendItem(self.cdrom_item) self.optionmenu = wx.Menu() self.option_item = wx.MenuItem(self.expertmenu, 210, _("General")) self.option_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/input-gaming.png")) self.optionmenu.AppendItem(self.option_item) self.option_item = wx.MenuItem(self.expertmenu, 211, _("Internet")) self.option_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/internet-web-browser.png")) self.optionmenu.AppendItem(self.option_item) self.option_item = wx.MenuItem(self.expertmenu, 212, _("Environment")) self.option_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/user-desktop.png")) self.optionmenu.AppendItem(self.option_item) self.option_item = wx.MenuItem(self.expertmenu, 213, _("System")) self.option_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/application-x-executable.png")) self.optionmenu.AppendItem(self.option_item) self.option_item = wx.MenuItem(self.expertmenu, 214, _("Plugins")) self.option_item.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/package-x-generic.png")) self.optionmenu.AppendItem(self.option_item) self.pluginsmenu = wx.Menu() files = os.listdir(Variables.playonlinux_rep + "/plugins") files.sort() self.plugin_list = [] self.i = 0 self.j = 0 while (self.i < len(files)): if (os.path.exists(Variables.playonlinux_rep + "/plugins/" + files[self.i] + "/scripts/menu")): if (os.path.exists(Variables.playonlinux_rep + "/plugins/" + files[self.i] + "/enabled")): self.plugin_item = wx.MenuItem(self.expertmenu, 300 + self.j, files[self.i]) self.icon_look_for = Variables.playonlinux_rep + "/plugins/" + files[ self.i] + "/icon" if (os.path.exists(self.icon_look_for)): self.bitmap = wx.Bitmap(self.icon_look_for) else: self.bitmap = wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux16.png") self.plugin_item.SetBitmap(self.bitmap) self.pluginsmenu.AppendItem(self.plugin_item) wx.EVT_MENU(self, 300 + self.j, self.run_plugin) self.plugin_list.append(files[self.i]) self.j += 1 self.i += 1 if (self.j > 0): self.pluginsmenu.AppendSeparator() self.option_item_p = wx.MenuItem(self.expertmenu, 214, _("Plugin manager")) self.option_item_p.SetBitmap( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/package-x-generic.png")) self.pluginsmenu.AppendItem(self.option_item_p) self.last_string = "" # /!\ id 115 utilisé par wineserver # # /!\ id 117 et 118 utilisés aussi # self.helpmenu = wx.Menu() self.helpmenu.Append(wx.ID_ABOUT, _("About")) self.helpmenu.Append(500, _("Donate")) self.menubar = wx.MenuBar() self.menubar.Append(self.filemenu, _("File")) self.menubar.Append(self.expertmenu, _("Tools")) self.menubar.Append(self.optionmenu, _("Settings")) self.menubar.Append(self.pluginsmenu, _("Plugins")) self.menubar.Append(self.helpmenu, _("Help")) self.SetMenuBar(self.menubar) self.toolbar = self.CreateToolBar(wx.TB_TEXT) self.toolbar.AddLabelTool( wx.ID_OPEN, _("Run"), wx.ArtProvider.GetBitmap("gtk-open", wx.ART_TOOLBAR)) self.toolbar.AddLabelTool( wx.ID_ADD, _("Install"), wx.ArtProvider.GetBitmap("gtk-add", wx.ART_TOOLBAR)) self.toolbar_remove = self.toolbar.AddLabelTool( wx.ID_DELETE, _("Remove"), wx.ArtProvider.GetBitmap("gtk-delete", wx.ART_TOOLBAR)) #self.toolbar.AddLabelTool(wx.ID_REFRESH, _("Refresh the repository"), wx.ArtProvider.GetBitmap("gtk-refresh", wx.ART_TOOLBAR)) self.toolbar.AddLabelTool( 121, _("Configure this application"), wx.ArtProvider.GetBitmap("gtk-edit", wx.ART_TOOLBAR)) self.toolbar_remove = self.toolbar.AddLabelTool( 122, _("Close all"), wx.ArtProvider.GetBitmap("gtk-close", wx.ART_TOOLBAR)) self.Reload(self) wx.EVT_MENU(self, wx.ID_OPEN, self.Run) wx.EVT_MENU(self, wx.ID_ADD, self.InstallMenu) wx.EVT_MENU(self, wx.ID_ABOUT, self.About) wx.EVT_MENU(self, wx.ID_EXIT, self.ClosePol) wx.EVT_MENU(self, wx.ID_REFRESH, self.UpdatePol) wx.EVT_MENU(self, wx.ID_DELETE, self.UninstallGame) wx.EVT_MENU(self, 122, self.RKillAll) # Expert wx.EVT_MENU(self, 101, self.Reload) wx.EVT_MENU(self, 107, self.WineVersion) wx.EVT_MENU(self, 108, self.Executer) wx.EVT_MENU(self, 109, self.PolShell) wx.EVT_MENU(self, 115, self.killwineserver) wx.EVT_MENU(self, 120, self.Autorun) wx.EVT_MENU(self, 121, self.Configure) #Options wx.EVT_MENU(self, 210, self.Options) wx.EVT_MENU(self, 211, self.Options) wx.EVT_MENU(self, 212, self.Options) wx.EVT_MENU(self, 213, self.Options) wx.EVT_MENU(self, 214, self.Options) wx.EVT_MENU(self, 215, self.Options) wx.EVT_CLOSE(self, self.ClosePol) wx.EVT_TREE_ITEM_ACTIVATED(self, 105, self.Run) wx.EVT_TREE_SEL_CHANGED(self, 105, self.Select) #wx.EVT_TREE_ITEM_MENU(self, 105, self.OnRightDown) #Timer, regarde toute les secondes si il faut actualiser la liste self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer) self.timer.Start(200) #Pop-up menu for game list: beginning wx.EVT_TREE_ITEM_MENU(self, 105, self.RMBInGameList) wx.EVT_MENU(self, 230, self.RWineConfigurator) wx.EVT_MENU(self, 231, self.RRegistryEditor) wx.EVT_MENU(self, 232, self.GoToAppDir) wx.EVT_MENU(self, 233, self.ChangeIcon) wx.EVT_MENU(self, 234, self.UninstallGame) wx.EVT_MENU(self, 235, self.RKill) wx.EVT_MENU(self, 500, self.donate)
def AutoReload(self, event): if (os.path.exists(self.file_id)): self.fichier = open(self.file_id, "r").readlines() try: if (self.gauge_i < 2): self.gauge_i += 1 else: self.gauge.Pulse() self.gauge_i = 0 except: pass if (self.fichier != self.oldfichier): if (len(self.fichier) > 0): if (self.fichier[0] == "MsgIn\n"): if (len(self.fichier) > 1): if (self.fichier[1] != "pulse\n" and self.fichier[1] != "set_text\n"): self.Destroy_all() if (len(self.fichier) > 1): if (self.fichier[1] == "pulse\n"): self.pulsebar.SetValue( int(self.fichier[2]) / 2) if (self.fichier[1] == "set_text\n"): self.texte_bis.SetLabel( self.fichier[2].replace("\\n", "\n")) self.texte_bis.SetPosition( (20, 105 + self.space * 16)) self.texte_bis.Show() if (self.fichier[1] == "champ\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.champ.SetPosition( (20, 85 + self.space * 16)) self.champ.SetValue(self.fichier[4].replace( "\n", "")) self.champ.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ) if (self.fichier[1] == "browse\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.browse.SetPosition( ((330, 85 + self.space * 16))) self.browse.Show() self.champ.SetPosition( (20, 85 + self.space * 16)) self.champ.SetValue(self.fichier[4].replace( "\n", "")) self.champ.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ) if (self.fichier[1] == "menu\n" or self.fichier[1] == "menu_num\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.cut = self.fichier[5].replace("\n", "") self.areaList = string.split( self.fichier[4].replace("\n", ""), self.cut) self.Menu.Clear() self.Menu.InsertItems(self.areaList, 0) self.Menu.Select(0) self.Menu.Show() self.DrawCancel() self.DrawNext() # Good event if (self.fichier[1] == "menu\n"): wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu) wx.EVT_LISTBOX_DCLICK( self, 103, self.release_menu) if (self.fichier[1] == "menu_num\n"): wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_num) wx.EVT_LISTBOX_DCLICK( self, 103, self.release_menu_num) if (self.fichier[1] == "menu_list\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.cut = self.fichier[5].replace("\n", "") self.areaList = string.split( self.fichier[4].replace("\n", ""), self.cut) self.MenuList.SetPosition( (20, 85 + self.space * 16)) self.MenuList.Clear() self.MenuList.AppendItems(self.areaList) self.MenuList.Show() self.DrawCancel() self.DrawNext() if (self.fichier[6] != "\n"): self.MenuList.SetValue( self.fichier[6].replace("\n", "")) else: self.MenuList.SetValue(self.areaList[0]) wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_list) if (self.fichier[1] == "checkbox_list\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.scrolled_panel.Show() self.cut = self.fichier[5].replace("\n", "") self.areaList = string.split( self.fichier[4].replace("\n", ""), self.cut) self.i = 0 self.item_check = [] while (self.i < len(self.areaList)): self.item_check.append( wx.CheckBox( self.scrolled_panel, -1, pos=(0, (self.i * 25)), label=str(self.areaList[self.i]))) self.i += 1 self.scrolled_panel.SetVirtualSize( (0, self.i * (25))) self.scrolled_panel.SetScrollRate(0, 25) self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_checkboxes) if (self.fichier[1] == "attendre_signal\n" or self.fichier[1] == "pulsebar\n"): self.DrawHeader() self.timer_attendre = wx.Timer(self, 1) self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.gauge_space = self.space if (self.fichier[1] == "attendre_signal\n"): self.gauge.Show() self.gauge.SetPosition( (20, 85 + self.space * 16)) else: self.pulsebar.Show() self.pulsebar.SetPosition( (20, 85 + self.space * 16)) self.DrawCancel() self.DrawNext() self.NextButton.Enable(False) if (self.fichier[1] == "download\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.space = self.fichier[2].count("\\n") + 1 self.gauge.Show() self.gauge.SetPosition( (20, 85 + self.space * 16)) self.txtEstimation.SetPosition( (20, 105 + self.space * 16)) self.txtEstimation.Show() #self.titre.SetFont(self.fontText) self.DrawCancel() self.DrawNext() self.NextButton.Enable(False) self.DownloadFile( self.fichier[4].replace("\n", ""), self.fichier[5].replace("\n", "")) #wx.EVT_BUTTON(self, 300, self.release) if (self.fichier[1] == "get_games\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() self.add_games() self.MenuGames.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame) wx.EVT_TREE_ITEM_ACTIVATED( self, 111, self.release_menugame) if (self.fichier[1] == "message\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() #self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356)) self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release) if (self.fichier[1] == "licence\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() #self.Mchamp.SetValue(open(self.fichier[4].replace("\n",""),"r").read()) # self.texte_panel.SetLabel( open(self.fichier[4].replace("\n", ""), "r").read()) self.texte_panel.Wrap(400) self.texte_panel.Show() self.scrolled_panel.Show() self.scrolled_panel.SetVirtualSize( self.texte_panel.GetSize()) self.scrolled_panel.SetScrollRate(0, 25) self.MCheckBox.Show() self.DrawCancel() self.DrawNext() self.NextButton.Enable(False) wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release) if (self.fichier[1] == "question\n"): self.DrawHeader() self.texte.SetLabel(self.fichier[2].replace( "\\n", "\n")) self.texte.Show() self.titre.SetLabel(self.fichier[3]) self.titre.Show() #self.titre.SetFont(self.fontText) self.YesButton.Show() self.NoButton.Show() if (self.fichier[1] == "make_shortcut\n"): self.DrawHeader() self.texte.SetLabel(_("Create a shortcut :")) self.texte.Show() #self.titre_header = wx.StaticText(self.header, -1, _("PlayOnMac Wizard"),pos=(5,5), size=(340,356)) #self.texte.SetFont(self.fontText) #self.titre_header.SetFont(self.fontTitre) self.titre_header.Show() #self.titre = wx.StaticText(self.header, -1, _("Do you want a shortcut for ")+self.fichier[2].replace("\n","")+" ?",pos=(20,30), size=(340,356)) self.titre.SetLabel( _("Do you want a shortcut for ") + self.fichier[2].replace("\n", "") + " ?") self.titre.Show() self.desktop.show() self.menu.show() #self.titre.SetFont(self.fontText) self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_icons) if (self.fichier[1] == "free_presentation\n"): self.MainPanel.Show() self.titreP.SetLabel(self.fichier[2]) self.titreP.Wrap(280) self.texteP.SetLabel(self.fichier[3].replace( "\\n", "\n").decode("utf8")) self.texteP.Wrap(360) self.texteP.Show() self.DrawCancel() self.DrawNext() wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release) self.DrawImage() if (self.fichier[1] == "exit\n"): os.remove(self.file_id) self.Close() self.oldfichier = self.fichier