def __init__(self, liste_objets=[]): self.liste_objets = liste_objets self.dictParametres = {} # Création du stock d'images wx.FileSystem.AddHandler(wx.MemoryFSHandler()) self.stockImages = wx.MemoryFSHandler()
def __InitXRC(self): resourceText = open(XRCFILE).read() if sys.version_info.major == 2: wx.FileSystem_AddHandler(wx.MemoryFSHandler()) wx.MemoryFSHandler_AddFile(XRCFILE, resourceText) elif sys.version_info.major == 3: wx.FileSystem.AddHandler(wx.MemoryFSHandler()) # wx.MemoryFSHandler.AddFile( filename=XRCFILE, image=resourceText ) wx.MemoryFSHandler.AddFileWithMimeType(XRCFILE, resourceText, 'xrc')
def set_plot_state(self, extra_high=False, extra_low=False): """ Build image state that wx.html understand by plotting, putting it into wx.FileSystem image object : extrap_high,extra_low: low/high extrapolations are possible extra-plots """ # some imports import wx import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg # we use simple plot, not plotpanel # make matlab figure fig = plt.figure() fig.set_facecolor('w') graph = fig.add_subplot(111) # data plot graph.errorbar(self.data.x, self.data.y, yerr=self.data.dy, fmt='o') # low Q extrapolation fit plot if not extra_low == 'False': graph.plot(self.theory_lowQ.x, self.theory_lowQ.y) # high Q extrapolation fit plot if not extra_high == 'False': graph.plot(self.theory_highQ.x, self.theory_highQ.y) graph.set_xscale("log", nonposx='clip') graph.set_yscale("log", nonposy='clip') graph.set_xlabel('$\\rm{Q}(\\AA^{-1})$', fontsize=12) graph.set_ylabel('$\\rm{Intensity}(cm^{-1})$', fontsize=12) canvas = FigureCanvasAgg(fig) # actually make image canvas.draw() # make python.Image object # size w, h = canvas.get_width_height() # convert to wx.Image wximg = wx.EmptyImage(w, h) # wxim.SetData(img.convert('RGB').tostring() ) wximg.SetData(canvas.tostring_rgb()) # get the dynamic image for the htmlwindow wximgbmp = wx.BitmapFromImage(wximg) # store the image in wx.FileSystem Object wx.FileSystem.AddHandler(wx.MemoryFSHandler()) # use wx.MemoryFSHandler self.imgRAM = wx.MemoryFSHandler() # AddFile, image can be retrieved with 'memory:filename' self.imgRAM.AddFile('img_inv.png', wximgbmp, wx.BITMAP_TYPE_PNG) self.wximgbmp = 'memory:img_inv.png' self.image = fig
def __init__(self, parent): wx.Panel.__init__(self, parent) self.frame = parent self.leftsizer = wx.BoxSizer(wx.HORIZONTAL) self.topsizer = wx.BoxSizer(wx.VERTICAL) btnsize = (150, -1) mfs = wx.MemoryFSHandler() wx.FileSystem.AddHandler(mfs) self.htmlbox = wx.html.HtmlWindow(self, -1, size=(800, 1500)) self.htmlbox.SetPage(welcome) self.topsizer.Add(self.htmlbox, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.ALL, 40) self.ico = wx.StaticBitmap( self, -1, wx.Bitmap(resource_path("massoc_large.png"), wx.BITMAP_TYPE_ANY)) self.menusizer = wx.BoxSizer(wx.VERTICAL) self.doc_btn = wx.Button(self, label="Documentation", size=btnsize) self.doc_btn.Bind(wx.EVT_BUTTON, self.link_docs) self.menusizer.AddSpacer(50) self.menusizer.Add(self.ico, 1, wx.ALIGN_CENTER_HORIZONTAL, 5) self.menusizer.AddSpacer(50) self.menusizer.Add(self.doc_btn, 1, wx.EXPAND, 5) self.menusizer.AddSpacer(300) self.leftsizer.AddSpacer(20) self.leftsizer.Add(self.menusizer) self.leftsizer.AddSpacer(50) self.leftsizer.Add(self.topsizer) self.SetSizerAndFit(self.leftsizer)
def __init__(self): super().__init__(False, useBestVisual=True) # Do additional groundwork self.__path = os.path.dirname(sys.argv[0]) wx.FileSystem.AddHandler(wx.MemoryFSHandler()) wx.Image.AddHandler(wx.PNGHandler())
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log # make the components label = wx.StaticText(self, -1, "The lower panel was built from this XML:") label.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) resourceText = open(RESFILE).read() text = wx.TextCtrl(self, -1, resourceText, style=wx.TE_READONLY | wx.TE_MULTILINE) text.SetInsertionPoint(0) line = wx.StaticLine(self, -1) # This shows a few different ways to load XML Resources if 0: # XML Resources can be loaded from a file like this: res = xrc.XmlResource(RESFILE) elif 1: # or from a Virtual FileSystem: wx.FileSystem.AddHandler(wx.MemoryFSHandler()) wx.MemoryFSHandler().AddFile("XRC_Resources/data_file", resourceText) res = xrc.XmlResource("memory:XRC_Resources/data_file") else: # or from a string, like this: res = xrc.EmptyXmlResource() res.LoadFromString(resourceText) # Now create a panel from the resource data panel = res.LoadPanel(self, "MyPanel") # and do the layout sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(label, 0, wx.EXPAND | wx.TOP | wx.LEFT, 5) sizer.Add(text, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(line, 0, wx.EXPAND) sizer.Add(panel, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.SetAutoLayout(True)
def AddRTCHandlers(self): if text.RichTextBuffer.FindHandlerByType( text.RICHTEXT_TYPE_HTML) is not None: return text.RichTextBuffer.AddHandler( text.RichTextXMLHandler(name="Other XML", ext="ox", type=99)) text.RichTextBuffer.AddHandler(text.RichTextHTMLHandler()) wx.FileSystem.AddHandler(wx.MemoryFSHandler())
def init_filesystems(app): wx.FileSystem.AddHandler(WxIconFileSystemHandler()) wx.FileSystem.AddHandler(wx.MemoryFSHandler()) global about about['app'] = app.app_blank_page.encode('utf-8') global image_paths path = get_image_path("icons") if path not in image_paths: image_paths.append(path)
def OnInit(self): # add the image to the MemoryFileSystem: mfs = wx.MemoryFSHandler() wx.FileSystem_AddHandler(mfs) mfs.AddFile("smalltest.png", smalltest.GetImage(), wx.BITMAP_TYPE_PNG) # Initializing the Frame frame = DemoFrame(None, title="HTML Tester Window", size=(500, 500)) self.SetTopWindow(frame) frame.Show(True) return True
def OnInit(self): mfs = wx.MemoryFSHandler() noteImage = wx.BitmapFromImage( wx.Image(constants.NOTES_IMAGE, wx.BITMAP_TYPE_PNG).Scale(24, 24)) okImage = wx.BitmapFromImage( wx.Image(constants.OK_IMAGE, wx.BITMAP_TYPE_PNG).Scale(24, 24)) notOkImage = wx.BitmapFromImage( wx.Image(constants.NOT_OK_IMAGE, wx.BITMAP_TYPE_PNG).Scale(24, 24)) mfs.AddFile("edit-notes.png", noteImage, wx.BITMAP_TYPE_PNG) mfs.AddFile("ok.png", okImage, wx.BITMAP_TYPE_PNG) mfs.AddFile("not-ok.png", notOkImage, wx.BITMAP_TYPE_PNG) wx.FileSystem_AddHandler(mfs) return True
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log # make the components label = wx.StaticText(self, -1, "The lower panel was built from this XML:") label.SetFont( wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) with open(RESFILE, 'rb') as f: resourceBytes = f.read() text = wx.TextCtrl(self, -1, resourceBytes, style=wx.TE_READONLY | wx.TE_MULTILINE) text.SetInsertionPoint(0) line = wx.StaticLine(self, -1) # This shows a few different ways to load XML Resources if 0: # XML Resources can be loaded from a file like this: res = xrc.XmlResource(RESFILE) elif 1: # or from a Virtual FileSystem: wx.FileSystem.AddHandler(wx.MemoryFSHandler()) wx.MemoryFSHandler.AddFile("my_XRC_data", resourceBytes) # notice the matching filename res = xrc.XmlResource("memory:my_XRC_data") else: # or from a buffer compatible object, like this: res = xrc.XmlResource() res.LoadFromBuffer(resourceBytes) # Now create a panel from the resource data panel = res.LoadPanel(self, "MyPanel") # and do the layout sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(label, 0, wx.EXPAND | wx.TOP | wx.LEFT, 5) sizer.Add(text, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(line, 0, wx.EXPAND) sizer.Add(panel, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.SetAutoLayout(True)
def AddRTCHandlers(self): # make sure we haven't already added them. if rt.RichTextBuffer.FindHandlerByType(rt.RICHTEXT_TYPE_HTML) is not None: return # This would normally go in your app's OnInit method. I'm # not sure why these file handlers are not loaded by # default by the C++ richtext code, I guess it's so you # can change the name or extension if you wanted... rt.RichTextBuffer.AddHandler(rt.RichTextHTMLHandler()) rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler()) # ...like this rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler(name="Noetext", ext="ntx", type=99)) # This is needed for the view as HTML option since we tell it # to store the images in the memory file system. wx.FileSystem.AddHandler(wx.MemoryFSHandler())
def initUI(self): panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) font = wx.Font(22, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD) labelTitle = wx.StaticText(panel, label="YOUR PAYMENT") labelTitle.SetFont(font) hbox1.Add(labelTitle, flag=wx.ALIGN_CENTRE, proportion=1) vbox.Add(hbox1, flag=wx.ALIGN_CENTRE | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) hbox2 = wx.BoxSizer(wx.VERTICAL) fontRichText = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL) rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler()) # add suppport to read xml for richtext wx.FileSystem.AddHandler(wx.MemoryFSHandler()) # add suppport to read xml for richtext richText = rt.RichTextCtrl(panel, style=wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER); richText.SetFont(fontRichText) path = os.path.abspath(self.instructionFile) richText.LoadFile(path, rt.RICHTEXT_TYPE_XML) richText.SetEditable(False) # richText.SetBackgroundColour(wx.Colour(240, 240, 240)) hbox2.Add(richText, flag=wx.ALIGN_CENTER | wx.EXPAND, proportion=1) vbox.Add(hbox2, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=10, proportion=1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) boxNext = wx.BoxSizer(wx.VERTICAL) buttonNext = wx.Button(panel, label="GO TO THE EXPERIMENT") buttonNext.SetFont(font) buttonNext.Bind(wx.EVT_BUTTON, self.OnButtonNextClick) boxNext.Add(buttonNext, flag=wx.ALIGN_RIGHT) boxPrev = wx.BoxSizer(wx.VERTICAL) buttonPrev = wx.Button(panel, label="PREV") buttonPrev.SetFont(font) buttonPrev.Bind(wx.EVT_BUTTON, self.OnButtonPrevClick) boxPrev.Add(buttonPrev, flag=wx.ALIGN_LEFT) hbox3.Add(boxPrev, flag=wx.ALIGN_LEFT, proportion=1) hbox3.Add(boxNext, flag=wx.ALIGN_RIGHT, proportion=1) vbox.Add(hbox3, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) panel.SetSizer(vbox)
def __init__(self, lists): wx.App.__init__(self, redirect=False) mfs = wx.MemoryFSHandler() wx.FileSystem_AddHandler(mfs) mfs.AddFile("globe.png", icon.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("cycle.png", cycle.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("download.png", download.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("downloaded.png", downloaded.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("error.png", error.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("warning.png", warning.GetImage(), wx.BITMAP_TYPE_PNG) mfs.AddFile("logo.png", logo.GetImage(), wx.BITMAP_TYPE_PNG) default_connection = get_default_connection() if default_connection: parameters = get_saved_connection(default_connection) parameters["engine"] = default_connection engine = choose_engine(parameters) else: wizard = ConnectWizard(lists, ENGINE_LIST) success = wizard.RunWizard(wizard.pages[0]) if not success: wizard.Destroy() return engine = wizard.CONNECTION.engine options = wizard.CONNECTION.option opts = dict() for key in options.keys(): opts[key] = options[key].GetValue() engine.opts = opts wizard.Destroy() try: engine.get_connection() except: pass self.frame = Frame(None, -1, "EcoData Retriever version %s" % VERSION, lists, engine) self.frame.Show()
class AboutDlg(wx.Dialog): __mem = wx.MemoryFSHandler() def __init__(self, parent): super().__init__(parent, title="About Satisfactory Savegame Repairer", \ style=wx.DEFAULT_DIALOG_STYLE) res = os.path.join(wx.App.Get().Path, "Resources/Logo-128x128.png") res = wx.Image(res) self.__mem.AddFile('logo.png', res, wx.BITMAP_TYPE_PNG) res = os.path.join(wx.App.Get().Path, "Resources/About.res") with open(res, "rt") as file: content = file.read() view = wx.html.HtmlWindow(self, size=(666, 333), style=wx.html.HW_SCROLLBAR_NEVER) view.SetPage(content) view.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.onLink) self.v_sizer = wx.BoxSizer(wx.VERTICAL) self.v_sizer.AddSpacer(5) self.v_sizer.Add(view, 1, wx.EXPAND) self.v_sizer.AddSpacer(10) self.v_sizer.Add(wx.Button(parent=self, label="OK", size=wx.DefaultSize, id=wx.ID_OK)\ , 0, wx.FIXED_MINSIZE|wx.ALIGN_CENTER) self.v_sizer.AddSpacer(5) self.h_sizer = wx.BoxSizer(wx.HORIZONTAL) self.h_sizer.AddSpacer(5) self.h_sizer.Add(self.v_sizer) self.h_sizer.AddSpacer(5) self.SetSizerAndFit(self.h_sizer) def ShowModal(self, *args, **kwargs): rv = wx.Dialog.ShowModal(self, *args, **kwargs) self.__mem.RemoveFile('logo.png') return rv def onLink(self, event): webbrowser.open(event.LinkInfo.Href, new=2)
def SetupMemoryFiles(): # Set up an in-memory file system with virtual "files" that can be # loaded into the webview just like network or local file sources. # These "files" can be access using a protocol specifier of "memory:" wx.FileSystem.AddHandler(wx.MemoryFSHandler()) wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) wx.MemoryFSHandler.AddFile( "page1.html", "<html><head><title>File System Example</title>" "<link rel='stylesheet' type='text/css' href='memory:test.css'>" "</head><body><h1>Page 1</h1>" "<p><img src='memory:logo.png'></p>" "<p>This file was loaded directly from a virtual in-memory filesystem.</p>" "<p>Here's another page: <a href='memory:page2.html'>Page 2</a>.</p></body>" ) wx.MemoryFSHandler.AddFile( "page2.html", "<html><head><title>File System Example</title>" "<link rel='stylesheet' type='text/css' href='memory:test.css'>" "</head><body><h1>Page 2</h1>" "<p><a href='memory:page1.html'>Page 1</a> was better.</p></body>") wx.MemoryFSHandler.AddFile("test.css", "h1 {color: red;}") wx.MemoryFSHandler.AddFile('logo.png', wx.Bitmap(LOGO), wx.BITMAP_TYPE_PNG)
def __init__(self, parent, id=-1, size=wx.DefaultSize): #, bgcolor=None): wx.Panel.__init__(self, parent, id, size=size) #self.Text = wx.TextCtrl ( self, -1, # style = wx.TE_MULTILINE | wx.TE_PROCESS_ENTER ) import wx.richtext as rt self.Text = rt.RichTextCtrl ( self, style = wx.VSCROLL|wx.HSCROLL\ |wx.TE_MULTILINE|wx.TE_PROCESS_ENTER \ |wx.WANTS_CHARS ) # VERY ESSENTIAL TO CATCH ARROW KEYS #|wx.NO_BORDER # make sure we haven't already added them. if not (rt.RichTextBuffer.FindHandlerByType(rt.RICHTEXT_TYPE_HTML)): # This would normally go in your app's OnInit method. I'm # not sure why these file handlers are not loaded by # default by the C++ richtext code, I guess it's so you # can change the name or extension if you wanted... rt.RichTextBuffer.AddHandler(rt.RichTextHTMLHandler()) rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler()) """ # ...like this rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler(name="Other XML", ext="ox", type=99)) """ # This is needed for the view as HTML option since we tell it # to store the images in the memory file system. wx.FileSystem.AddHandler(wx.MemoryFSHandler()) self.Text.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.Text, 1, wx.EXPAND) self.SetSizer(self.sizer)
def initUI(self): panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox2 = wx.BoxSizer(wx.VERTICAL) fontRichText = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL) rt.RichTextBuffer.AddHandler( rt.RichTextXMLHandler()) #add suppport to read xml for richtext wx.FileSystem.AddHandler( wx.MemoryFSHandler()) #add suppport to read xml for richtext richText = rt.RichTextCtrl(panel, style=wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER) richText.SetFont(fontRichText) path = os.path.abspath(self.instructionFile) richText.LoadFile(path, rt.RICHTEXT_TYPE_XML) richText.SetEditable(False) richText.SetBackgroundColour(wx.Colour(240, 240, 240)) hbox2.Add(richText, flag=wx.ALIGN_CENTER | wx.EXPAND, proportion=1) vbox.Add(hbox2, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=10, proportion=1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) buttonNext = wx.Button(panel, label="CLOSE THE SCREEN") font = wx.Font(22, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD) buttonNext.SetFont(font) buttonNext.Bind(wx.EVT_BUTTON, self.OnButtonCloseClick) buttonNext.SetFocus() hbox3.Add(buttonNext, proportion=1) vbox.Add(hbox3, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) panel.SetSizer(vbox)
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) repair_dialog_xrc = '''\ <?xml version="1.0" ?><resource class="unknown"> <object class="wxDialog" name="RepairDialog"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxPanel" name="repair_panel"> <size>640,480</size> <XRCED> <assign_var>1</assign_var> </XRCED> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="unknown" name="shell_ctrl"/> <option>1</option> <flag>wxALL|wxEXPAND|wxGROW</flag> </object> </object> </object> <option>1</option> <flag>wxALL|wxEXPAND|wxGROW</flag> <minsize>640,480</minsize> </object> </object> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/repair_dialog/repair_dialog_xrc', repair_dialog_xrc) __res.Load('memory:XRC/repair_dialog/repair_dialog_xrc')
def __init__(self, session): self.session = session from ..tool_api import ToolWindow self._scenes_window = ToolWindow("Scenes", "General", session, destroy_hides=True) #from wx.html2 import WebView, EVT_WEBVIEW_NAVIGATING, EVT_WEBVIEW_ERROR #self._scenes = WebView.New(self._scenes_window.ui_area, size=(700, 200)) from wx.html import HtmlWindow, EVT_HTML_LINK_CLICKED self._scenes = HtmlWindow(self._scenes_window.ui_area, size=(700, 200)) self._scenes.SetHTMLBackgroundColour(wx.Colour(0,0,0)) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self._scenes, 1, wx.EXPAND) self._scenes_window.ui_area.SetSizerAndFit(sizer) self._scenes_window.manage("top") self._scenes_window.shown = False #self._scenes.Bind(EVT_WEBVIEW_NAVIGATING, # self.OnWebViewNavigating, self._scenes) #self._scenes.Bind(EVT_WEBVIEW_ERROR, # self.OnWebViewError, self._scenes) wx.FileSystem.AddHandler(wx.MemoryFSHandler()) #self._scenes.RegisterHandler(wx.MemoryFSHandler()) self._scenes.Bind(EVT_HTML_LINK_CLICKED, self.OnHtmlLinkClicked) self.memory_files = []
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) interface_xrc = '''\ <?xml version="1.0" ?><resource> <object class="wxDialog" name="interface"> <title>Hybrid System</title> <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU</style> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxStaticBoxSizer"> <label>Geometries</label> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <object class="sizeritem"> <object class="wxStaticText"> <label>type</label> </object> <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALIGN_CENTRE_HORIZONTAL</flag> </object> <rows>8</rows> <vgap>5</vgap> <hgap>5</hgap> <object class="sizeritem"> <object class="wxChoice" name="TYPE"> <content> <item>single</item> </content> <selection>0</selection> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>La</label> </object> <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALIGN_CENTRE_HORIZONTAL</flag> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_La"> <value>40</value> <style/> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>Ha</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_Ha"> <value>40</value> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>Za</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_Za"> <value>0</value> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>Lb</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_Lb"> <value>20</value> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>Hb</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_Hb"> <value>20</value> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>Zb</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="PARA_Zb"> <value>0.5</value> </object> </object> </object> <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag> </object> </object> <option>1</option> <flag>wxALL|wxEXPAND</flag> </object> <object class="spacer"> <size>20,20</size> </object> <object class="sizeritem"> <object class="wxStaticBoxSizer"> <label>Mesh Control</label> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>7</rows> <object class="sizeritem"> <object class="wxStaticText"> <label>Mesh Size H Direction</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="MESH_H"> <value>0.25</value> </object> </object> <vgap>5</vgap> <hgap>5</hgap> <object class="sizeritem"> <object class="wxStaticText"> <label>Mesh Size L Direction</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="MESH_L"> <value>2.0</value> </object> </object> </object> <option>1</option> <flag>wxEXPAND</flag> </object> </object> <flag>wxALL|wxEXPAND</flag> </object> <object class="spacer"> <size>20,20</size> </object> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxHORIZONTAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>1</rows> <hgap>5</hgap> <object class="sizeritem"> <object class="wxButton"> <label>Help</label> </object> </object> <object class="sizeritem"> <object class="wxButton" name="Process"> <label>Process</label> </object> </object> </object> </object> </object> <flag>wxALIGN_RIGHT</flag> </object> </object> <flag>wxALL|wxEXPAND</flag> <border>10</border> </object> </object> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/interface/interface_xrc', interface_xrc) __res.Load('memory:XRC/interface/interface_xrc')
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) test_gui_xrc = '''\ <?xml version="1.0" ?><resource class="ImageTextToggleButton" version="2.5.3.0" xmlns="http://www.wxwidgets.org/wxxrc"> <object class="wxFrame" name="stream_frame"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxScrolledWindow" name="scrwin"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="FoldPanelBar" name="fpb"> <object class="FoldPanelItem"> <label>STREAMS</label> <XRCED> <assign_var>1</assign_var> </XRCED> <object class="StreamBar" name="stream_bar"> <add_button>1</add_button> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <spacing>0</spacing> <leftspacing>0</leftspacing> <rightspacing>0</rightspacing> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <flag>wxEXPAND</flag> </object> </object> <bg>#A52A2A</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <option>1</option> <flag>wxEXPAND</flag> <minsize>400,400</minsize> </object> </object> <size>400,400</size> <title>Stream panel test frame</title> </object> <object class="wxFrame" name="text_frame"> <object class="wxPanel" name="text_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxFlexGridSizer"> <object class="sizeritem"> <object class="wxStaticText"> <label>SuggestTextCtrl</label> </object> </object> <object class="sizeritem"> <object class="SuggestTextCtrl" name="txt_suggest"> <size>200,-1</size> <value>suggest text field</value> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>UnitIntegerCtrl</label> </object> </object> <object class="sizeritem"> <object class="UnitIntegerCtrl"> <size>200,-1</size> <value>0</value> <min>-10</min> <max>10</max> <unit>μm</unit> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> </object> </object> <object class="sizeritem"> <object class="wxStaticText" name="unit_float_label"> <label>UnitFloatCtrl</label> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="UnitFloatCtrl" name="unit_float"> <size>200,-1</size> <unit>g</unit> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>OwnerDrawnComboBox</label> </object> </object> <object class="sizeritem"> <object class="wxOwnerDrawnComboBox" name="txt_odcbox"> <size>200,14</size> <content> <item>aap</item> <item>noot</item> <item>mies</item> </content> <selection>1</selection> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE|wxCB_READONLY</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <cols>2</cols> <vgap>5</vgap> <hgap>5</hgap> </object> <flag>wxALL</flag> <border>5</border> </object> </object> <fg>#E6E6FA</fg> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>400,400</size> </object> <object class="wxFrame" name="button_frame"> <object class="wxPanel" name="button_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> </object> <fg>#E6E6FA</fg> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>400,400</size> </object> <object class="wxFrame" name="canvas_frame"> <object class="wxPanel" name="canvas_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> </object> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>404,400</size> <title>Cairo Test</title> <bg>#4D4D4D</bg> </object> <object class="wxFrame" name="fpb_frame"> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="wxScrolledWindow" name="scrwin"> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="FoldPanelBar" name="fpb"> <object class="FoldPanelItem" name="panel_1"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 1</label> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <family>default</family> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="FoldPanelItem" name="panel_2"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 2</label> <collapsed>1</collapsed> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <family>default</family> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="FoldPanelItem" name="panel_3"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 3</label> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <family>default</family> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <spacing>0</spacing> <bg>#1E90FF</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <flag>wxEXPAND</flag> </object> <orient>wxVERTICAL</orient> </object> <bg>#A52A2A</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <option>1</option> <flag>wxEXPAND</flag> <minsize>100,100</minsize> </object> <orient>wxVERTICAL</orient> </object> <title>Fold Panel Bar Test Frame</title> <bg>#666666</bg> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/test_gui/test_gui_xrc', test_gui_xrc) __res.Load('memory:XRC/test_gui/test_gui_xrc')
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) test_gui_xrc = '''\ <?xml version="1.0" ?><resource version="2.5.3.0" xmlns="http://www.wxwidgets.org/wxxrc"> <object class="wxFrame" name="text_frame"> <object class="wxPanel" name="text_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxFlexGridSizer"> <object class="sizeritem"> <object class="wxStaticText"> <label>SuggestTextCtrl</label> </object> </object> <object class="sizeritem"> <object class="SuggestTextCtrl" name="txt_suggest"> <size>200,-1</size> <value>suggest text field</value> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>UnitIntegerCtrl</label> </object> </object> <object class="sizeritem"> <object class="UnitIntegerCtrl"> <size>200,-1</size> <value>0</value> <min>-10</min> <max>10</max> <unit>μm</unit> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> </object> </object> <object class="sizeritem"> <object class="wxStaticText" name="unit_float_label"> <label>UnitFloatCtrl</label> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="UnitFloatCtrl" name="unit_float"> <size>200,-1</size> <unit>g</unit> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <object class="sizeritem"> <object class="wxStaticText"> <label>OwnerDrawnComboBox</label> </object> </object> <object class="sizeritem"> <object class="wxOwnerDrawnComboBox" name="txt_odcbox"> <size>200,14</size> <content> <item>aap</item> <item>noot</item> <item>mies</item> </content> <selection>1</selection> <fg>#1E90FF</fg> <bg>#4D4D4D</bg> <style>wxBORDER_NONE|wxCB_READONLY</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> </object> <cols>2</cols> <vgap>5</vgap> <hgap>5</hgap> </object> <flag>wxALL</flag> <border>5</border> </object> </object> <fg>#E6E6FA</fg> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>400,400</size> </object> <object class="wxFrame" name="button_frame"> <object_ref ref="menu_bar"/> <object class="wxPanel" name="button_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> </object> <fg>#E6E6FA</fg> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>400,400</size> </object> <object class="wxFrame" name="canvas_frame"> <object_ref ref="menu_bar"/> <object class="wxPanel" name="canvas_panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> </object> <bg>#4D4D4D</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>400,400</size> <title>Cairo Test</title> <bg>#4D4D4D</bg> </object> <object class="wxFrame" name="fpb_frame"> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="wxScrolledWindow" name="scrwin"> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="FoldPanelBar" name="fpb"> <object class="FoldPanelItem" name="panel_1"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 1</label> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="FoldPanelItem" name="panel_2"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 2</label> <collapsed>1</collapsed> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="FoldPanelItem" name="panel_3"> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <object class="wxStaticText"> <label>LABEL</label> </object> <label>Test Panel 3</label> <fg>#1A1A1A</fg> <bg>#666666</bg> <font> <size>13</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <face>Ubuntu</face> <encoding>UTF-8</encoding> </font> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <spacing>0</spacing> <bg>#1E90FF</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <flag>wxEXPAND</flag> </object> <orient>wxVERTICAL</orient> </object> <bg>#A52A2A</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <option>1</option> <flag>wxEXPAND</flag> <minsize>100,100</minsize> </object> <orient>wxVERTICAL</orient> </object> <title>Fold Panel Bar Test Frame</title> <bg>#666666</bg> </object> <object class="wxFrame" name="grid_frame"> <object_ref ref="menu_bar"/> <object class="ViewportGrid" name="grid_panel"> <object class="wxPanel" name="red"> <bg>#E65F5F</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxPanel" name="blue"> <bg>#57B4BA</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxPanel" name="purple"> <bg>#E48BD3</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxPanel" name="brown"> <bg>#FFC292</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxPanel" name="yellow"> <bg>#FFF490</bg> <hidden>1</hidden> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxPanel" name="green"> <bg>#B2E926</bg> <hidden>1</hidden> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>500,500</size> <bg>#FFC9C9</bg> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <size>500,500</size> <title>Cairo Test</title> <centered>1</centered> <bg>#1E90FF</bg> </object> <object class="wxMenuBar" name="menu_bar"> <object class="wxMenu"> <object class="wxMenuItem" name="item_inspect"> <label>Inspect</label> <accel>Ctrl+V</accel> </object> <object class="separator"/> <object class="wxMenuItem"> <label>Quit</label> <accel>Ctrl+Q</accel> </object> <label>Extra</label> </object> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/test_gui/test_gui_xrc', test_gui_xrc) __res.Load('memory:XRC/test_gui/test_gui_xrc')
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) loaddisp_xrc = '''\ <?xml version="1.0" ?><resource> <object class="wxDialog" name="LDFRAME"> <title>Quck Plot: Load Versus Displacement</title> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>2</rows> <object class="sizeritem"> <object class="wxRadioBox" name="LD_LOAD_SOURCE"> <label>Load Source</label> <content> <item>Load from time</item> <item>Load From Reactions</item> </content> </object> <option>1</option> <flag>wxALL|wxEXPAND</flag> </object> </object> <option>1</option> <flag>wxALL|wxEXPAND</flag> <border>5</border> </object> <object class="sizeritem"> <object class="wxStaticBoxSizer"> <label>Reaction </label> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>4</rows> <object class="sizeritem"> <object class="wxStaticText" name="POST_L_ItemSourceLabel"> <label>Reaction Type</label> </object> </object> <object class="sizeritem"> <object class="wxChoice" name="POST_L_ItemSource"> <content> <item>Reaction Force X</item> <item>Reaction Force Y</item> <item>Reaction Force Z</item> <item>Reaction Moment X</item> <item>Reaction Moment Y</item> <item>Reaction Moment Z</item> </content> <selection>0</selection> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_L_ItemSelSingle"> <label>Single Item</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="POST_L_ItemSingle"> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_L_ItemSelList"> <label>Item List</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="POST_L_ItemList"> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_L_ItemSelSet"> <label>Item Set</label> </object> </object> <object class="sizeritem"> <object class="wxChoice" name="POST_L_ItemSet"> <content/> </object> </object> </object> <border>5</border> </object> </object> <flag>wxALL|wxEXPAND</flag> <border>5</border> </object> <object class="sizeritem"> <object class="wxStaticBoxSizer"> <label>Displacement</label> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>4</rows> <object class="sizeritem"> <object class="wxStaticText" name="POST_D_ItemSourceLabel"> <label>Displacement Type</label> </object> </object> <object class="sizeritem"> <object class="wxChoice" name="POST_D_ItemSource"> <content> <item>Displacement X</item> <item>Displacement Y</item> <item>Displacement Z</item> <item>Rotation X</item> <item>Rotation Y</item> <item>Rotation Z</item> </content> <selection>0</selection> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_D_ItemSelSingle"> <label>Single Item</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="POST_D_ItemSingle"> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_D_ItemSelList"> <label>Item List</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="POST_D_ItemList"> <size>120,20</size> </object> </object> <object class="sizeritem"> <object class="wxRadioButton" name="POST_D_ItemSelSet"> <label>Item Set</label> </object> </object> <object class="sizeritem"> <object class="wxChoice" name="POST_D_ItemSet"> <content/> </object> </object> </object> <border>5</border> </object> </object> <flag>wxALL|wxEXPAND</flag> <border>5</border> </object> <object class="sizeritem"> <object class="wxGridSizer"> <cols>2</cols> <rows>2</rows> <object class="spacer"> <size>0,0</size> </object> <object class="sizeritem"> <object class="wxButton" name="POST_LD_QUICKPLOT"> <label>Quick Plot</label> </object> <flag>wxALIGN_RIGHT</flag> </object> </object> <flag>wxALL|wxEXPAND</flag> <border>5</border> </object> </object> <option>1</option> <flag>wxALL|wxEXPAND</flag> <border>0</border> <border>5</border> </object> </object> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/loaddisp/loaddisp_xrc', loaddisp_xrc) __res.Load('memory:XRC/loaddisp/loaddisp_xrc')
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) textwindow_view_xrc = '''\ <?xml version="1.0" ?><resource> <object class="wxFrame" name="TextWindow"> <title>Results</title> <object class="wxToolBar" name="TextWindowToolBar"> <object class="tool" name="ToolNew"> <bitmap stock_id="wxART_NEW"/> <tooltip>Create A New Results File...</tooltip> </object> <object class="tool" name="ToolOpen"> <bitmap stock_id="wxART_FILE_OPEN"/> <tooltip>Open Results File...</tooltip> </object> <object class="tool" name="ToolSave"> <bitmap stock_id="wxART_FILE_SAVE"/> <tooltip>Save Results File</tooltip> </object> <object class="tool" name="ToolSaveAs"> <bitmap stock_id="wxART_FILE_SAVE_AS"/> <tooltip>Save Results File As...</tooltip> </object> <object class="separator"/> <object class="tool" name="ToolFontSmaller"> <bitmap>___icons_list_remove_png</bitmap> <tooltip>Decrease Font Size</tooltip> <label>TOOL</label> </object> <object class="tool" name="ToolFontBigger"> <bitmap>___icons_list_add_png</bitmap> <tooltip>Increase Font Size</tooltip> <label>TOOL</label> </object> <style>wxTB_FLAT|wxTB_HORIZONTAL</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxPanel" name="Panel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxTextCtrl" name="Text"> <size>700,300</size> <font> <size>10</size> <style>normal</style> <weight>normal</weight> <underlined>0</underlined> <family>default</family> <face>Courier New</face> </font> <style>wxTE_MULTILINE|wxTE_READONLY|wxTE_LINEWRAP</style> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <option>1</option> <flag>wxALL|wxEXPAND|wxADJUST_MINSIZE</flag> </object> </object> <XRCED> <assign_var>1</assign_var> </XRCED> </object> <option>1</option> <flag>wxALL|wxEXPAND</flag> </object> </object> </object> </resource>''' ___icons_list_remove_png = '''\ \x89PNG\x0d \x1a \x00\x00\x00\x0dIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\ \x1f\xf3\xffa\x00\x00\x00\x06bKGD\x00\x00\x00\x00\x00\x00\xf9C\xbb\x00\ \x00\x00\x09pHYs\x00\x00\x0d\xd7\x00\x00\x0d\xd7\x01B(\x9bx\x00\x00\x00\ \x07tIME\x07\xd6\x01\x0b\x0f;"\x00\\\x12\xc2\x00\x00\x00\x84IDAT8\xcb\xed\ \x91\xb1\x09\x83P\x10\x86\xbf\x07i\xdc\xc0:+\xe8\x08\x19#\xadmF\x08\x19\ \x0b\x88\xads\xc4\x05t\x88\xd4\xb6"D\xf3\xeeO!\xca\xb3\xb33\x85\x1f\x1c\ \x1c\x07\xffw\x1c\x07\x07\xfb\xe3\xe6&\xcd\xca\x1aH6\xe6\x9a\xba\xb8\xa6\ \x00\xa7`\x98<o\x17F\x13\x0e\x18\xbdV\x09i*\x07\xdc\xf3\xd7\xb2(\x14\xd0\ }<\xef\xb6G\x023a\x82~\x10\xde\x8b\xaf\x0938\xc7\xd1J\x1c \x9aG^m>\xe1\xf8\xfe?\xf1\x03\xacS-\xdbF\xe4\x80\xd8\x00\x00\x00\x00IE\ ND\xaeB`\x82''' ___icons_list_add_png = '''\ \x89PNG\x0d \x1a \x00\x00\x00\x0dIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\ \x1f\xf3\xffa\x00\x00\x00\x06bKGD\x00\x00\x00\x00\x00\x00\xf9C\xbb\x00\ \x00\x00\x09pHYs\x00\x00\x0d\xd7\x00\x00\x0d\xd7\x01B(\x9bx\x00\x00\x00\ \x07tIME\x07\xd6\x01\x0b\x10\x00\x11\x94Dx\xa1\x00\x00\x00\xd0IDAT8\xcb\ \xcd\x91\xbd\x0e\xc1`\x14\x86\x1f\xd2\xc5`\xb7r\x07\xd2\xba\x81\xc6`6[;\ tq\x07D\xd2\xc4d\x17\xb1Z\x0d&\x83\x84\x1b\xe8g7Z,Vi\xe2\xa7\xdf1\x10\x8a\ \xfa\x8b\x04\xefv\xf2\x9d\xbc\xf9\x9e\xe7\xc0\xaf\x93\xb8\xf7`9=\x1f0\x8f\ \xa3\xf2\xbb\x15+n/\xf9\xa0\xdc\xf4\\\x1b\xcf\xb5\x89\x14\xbdU\xf0R>.0\xee\ 0\xc79\x91\xc8xrbD\x99[\xd5"[-$\x80mx\xde\xf7\\\x1b\x11\x109X\xafw\xc6\xe6\ \xcd\x0f\x00V\xeb\x90\xf92@\x04\xb4\x16\xb4@\xb0\x11\xc2P\xd8iAk\xc8eR\xf1\ \x08\x80jt&\x17\x08\xe5R\x01\x80\xc1\xc8\xbf&RO\xe5XNO\x86\xd3\x854\xfb\ 3\xb9\xe2\xff\xf2\x19\xf3\xd9\xf4kg\x8c\x89\xaa\xb5O\xb6\x15\x9b=TrK\x0b\ \x8b\xb2w\x8e\x00\x00\x00\x00IEND\xaeB`\x82''' wx.MemoryFSHandler.AddFile('XRC/textwindow_view/textwindow_view_xrc', textwindow_view_xrc) wx.MemoryFSHandler.AddFile('XRC/textwindow_view/___icons_list_remove_png', ___icons_list_remove_png) wx.MemoryFSHandler.AddFile('XRC/textwindow_view/___icons_list_add_png', ___icons_list_add_png) __res.Load('memory:XRC/textwindow_view/textwindow_view_xrc')
def test_filesys04(self): wx.FileSystem.AddHandler(wx.MemoryFSHandler())
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) manageLinkedProjects_xrc = '''\ <?xml version="1.0" ?><resource class="wxStaticText"> <object class="wxDialog" name="ManageLinked"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxPanel"> <size>40</size> </object> <flag>wxGROW</flag> </object> <object class="sizeritem"> <object class="wxListBox" name="theList"> <pos>0,0</pos> <size>320, 240</size> <style>wxSIMPLE_BORDER|wxFULL_REPAINT_ON_RESIZE</style> </object> <option>1</option> <flag>wxGROW</flag> <border>0</border> <minsize>322, 200</minsize> </object> </object> <option>1</option> <flag>wxGROW</flag> </object> <object class="sizeritem"> <object class="wxPanel"> <object class="wxButton" name="Unlink"> <pos>550, 10</pos> <size>80, 30</size> <label>Close</label> </object> <object class="wxButton" name="Cancel"> <label>Close</label> <default>1</default> <pos>460, 10</pos> <size>80, 30</size> </object> </object> <option>0</option> <flag>wxEXPAND</flag> <minsize>640, 40</minsize> </object> </object> <pos>0,0</pos> <size>640, 320</size> <title>Manage Projects</title> <centered>1</centered> </object> </resource>''' wx.MemoryFSHandler.AddFile( 'XRC/manageLinkedProjects/manageLinkedProjects_xrc', manageLinkedProjects_xrc) __res.Load('memory:XRC/manageLinkedProjects/manageLinkedProjects_xrc')
def initUI(self): panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) fontRichText = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL) rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler()) # add suppport to read xml for richtext wx.FileSystem.AddHandler(wx.MemoryFSHandler()) # add suppport to read xml for richtext richText = rt.RichTextCtrl(panel, style=wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER, size=(-1, 100)); richText.SetFont(fontRichText) path = os.path.abspath(self.instructionFile) richText.LoadFile(path, rt.RICHTEXT_TYPE_XML) richText.SetEditable(False) richText.SetFocus() # richText.SetBackgroundColour(wx.Colour(240,240,240)) hbox1.Add(richText, flag=wx.EXPAND, proportion=1) vbox.Add(hbox1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.grid = gr.Grid(panel, -1) grid = self.grid grid.CreateGrid(0, 0) csvPath = os.path.abspath(self.sheetFile) with open(csvPath, 'rb') as csvfile: csvReader = csv.reader(csvfile, delimiter=',') nCol = len(next(csvReader)) grid.AppendCols(numCols=nCol) csvfile.seek(0) y = 0 for row in csvReader: if y > COL_HEADER: grid.AppendRows(1) x = 0 for cell in row: if y == COL_HEADER: grid.SetColLabelValue(x, cell) if y > COL_HEADER: grid.SetCellValue(y - 1, x, cell) if x == 0: grid.SetCellBackgroundColour(y - 1, 0, wx.Colour(240, 240, 240)) x += 1 y += 1 grid.EnableEditing(False) grid.AutoSizeColumns() grid.SetCellHighlightColour(wx.Colour(200, 200, 200)) grid.SetSelectionBackground(wx.Colour(200, 200, 200)) grid.SetCellHighlightPenWidth(10) grid.Bind(gr.EVT_GRID_SELECT_CELL, self.OnCellSelect) grid.Bind(gr.EVT_GRID_RANGE_SELECT, self.OnGridRangeSelect) hbox2.Add(grid, flag=wx.GROW | wx.ALL, proportion=1) vbox.Add(hbox2, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=10, proportion=1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) font = wx.Font(22, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD) boxNext = wx.BoxSizer(wx.VERTICAL) buttonNext = wx.Button(panel, label="NEXT") buttonNext.SetFont(font) buttonNext.Bind(wx.EVT_BUTTON, self.OnButtonNextClick) boxNext.Add(buttonNext, flag=wx.ALIGN_RIGHT) boxConfirm = wx.BoxSizer(wx.VERTICAL) buttonConfirm = wx.Button(panel, label="CONFIRM") buttonConfirm.SetFont(font) buttonConfirm.Bind(wx.EVT_BUTTON, self.OnButtonConfirmClick) boxConfirm.Add(buttonConfirm, flag=wx.ALIGN_CENTER) boxPrev = wx.BoxSizer(wx.VERTICAL) buttonPrev = wx.Button(panel, label="PREV") buttonPrev.SetFont(font) buttonPrev.Bind(wx.EVT_BUTTON, self.OnButtonPrevClick) boxPrev.Add(buttonPrev, flag=wx.ALIGN_LEFT) hbox3.Add(boxPrev, flag=wx.ALIGN_LEFT, proportion=1) hbox3.Add(boxConfirm, flag=wx.EXPAND | wx.ALIGN_CENTRE, proportion=1) hbox3.Add(boxNext, flag=wx.ALIGN_RIGHT, proportion=1) vbox.Add(hbox3, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) panel.SetSizer(vbox) if self.type == self.TYPE_EXAMPLE: buttonConfirm.Hide() elif self.type == self.TYPE_REAL: buttonNext.Hide() buttonPrev.Hide() elif self.type == self.TYPE_REAL_FINAL: buttonNext.Hide() buttonPrev.Hide() buttonConfirm.SetLabelText("FINISH THE EXPERIMENT")
def initUI(self): # define a panel for the preference page decrement = 0.25 v1, v2, p1, p2, pn, v3, p3 = self.v1, self.v2, self.p1, self.p2, self.pn, self.v3, self.p3 row, col = 0, 0 panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) fontRichText = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL) rt.RichTextBuffer.AddHandler( rt.RichTextXMLHandler()) # add suppport to read xml for richtext wx.FileSystem.AddHandler( wx.MemoryFSHandler()) # add suppport to read xml for richtext richText = rt.RichTextCtrl(panel, style=wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER, size=(-1, 190)) richText.SetFont(fontRichText) path = os.path.abspath(self.instructionFile) richText.LoadFile(path, rt.RICHTEXT_TYPE_XML) # reading the xml from the richtext handler = wx.richtext.RichTextXMLHandler() buffer = richText.GetBuffer() inputOutput = StringIO() handler.DoSaveFile(buffer, inputOutput) inputOutput.seek(0) text = inputOutput.read() # replace the variable markups with the real values text = text.replace("[pn]", ('%.0f' % self.pn)) if (p1 == -1 or p1 == 0) and (p2 == -1 or p2 == 0) and (p3 != -1 and p3 != 0): text = text.replace("[var1]", ('%.2f' % self.v3)) text = text.replace("[pro1]", ('%.2f' % self.p3)) elif (p1 == -1 or p1 == 0) and (p2 != -1 and p2 != 0) and (p3 == -1 or p3 == 0): text = text.replace("[var1]", ('%.2f' % self.v2)) text = text.replace("[pro1]", ('%.2f' % self.p2)) elif (p1 == -1 or p1 == 0) and (p2 != -1 and p2 != 0) and (p3 != -1 and p3 != 0): text = text.replace("[var1]", ('%.2f' % self.v2)) text = text.replace("[pro1]", ('%.2f' % self.p2)) text = text.replace("[var2]", ('%.2f' % self.v3)) text = text.replace("[pro2]", ('%.2f' % self.p3)) elif (p1 != -1 and p1 != 0) and (p2 == -1 or p2 == 0) and (p3 == -1 or p3 == 0): text = text.replace("[var1]", ('%.2f' % self.v1)) text = text.replace("[pro1]", ('%.2f' % self.p1)) elif (p1 != -1 and p1 != 0) and (p2 == -1 or p2 == 0) and (p3 != -1 and p3 != 0): text = text.replace("[var1]", ('%.2f' % self.v1)) text = text.replace("[pro1]", ('%.2f' % self.p1)) text = text.replace("[var2]", ('%.2f' % self.v3)) text = text.replace("[pro2]", ('%.2f' % self.p3)) elif (p1 != -1 and p1 != 0) and (p2 != -1 and p2 != 0) and (p3 == -1 or p3 == 0): text = text.replace("[var1]", ('%.2f' % self.v1)) text = text.replace("[pro1]", ('%.2f' % self.p1)) text = text.replace("[var2]", ('%.2f' % self.v2)) text = text.replace("[pro2]", ('%.2f' % self.p2)) elif (p1 != -1 and p1 != 0) and (p2 != -1 and p2 != 0) and (p3 != -1 and p3 != 0): text = text.replace("[var1]", ('%.2f' % self.v1)) text = text.replace("[pro1]", ('%.2f' % self.p1)) text = text.replace("[var2]", ('%.2f' % self.v2)) text = text.replace("[pro2]", ('%.2f' % self.p2)) text = text.replace("[var3]", ('%.2f' % self.v3)) text = text.replace("[pro3]", ('%.2f' % self.p3)) # rewrite the xml back to the richtext handler2 = wx.richtext.RichTextXMLHandler() buffer2 = richText.GetBuffer() inputOutput2 = StringIO() buffer2.AddHandler(handler2) inputOutput2.write(text) inputOutput2.seek(0) handler.DoLoadFile(buffer2, inputOutput2) richText.Refresh() richText.SetEditable(False) # richText.SetBackgroundColour(wx.Colour(240,240,240)) hbox1.Add(richText, flag=wx.EXPAND, proportion=1) vbox.Add(hbox1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.grid = gr.Grid(panel, -1) grid = self.grid grid.CreateGrid(0, 0) if NUM_OF_COLS == 3: grid.AppendCols(4) grid.SetColLabelValue(0, "Proposed Certain\n Money") grid.SetColLabelValue(1, "I choose Option A") grid.SetColLabelValue(2, "I am not sure what to choose") grid.SetColLabelValue(3, "I choose Option B") elif NUM_OF_COLS == 5: grid.AppendCols(6) grid.SetColLabelValue(0, "Proposed Certain\n Money") grid.SetColLabelValue(1, "I choose Option A") grid.SetColLabelValue( 2, "I think I prefer Option A\nbut I'm not sure") grid.SetColLabelValue(3, "I am not sure what to choose") grid.SetColLabelValue( 4, "I think I prefer Option B\nbut I'm not sure") grid.SetColLabelValue(5, "I choose Option B") topValue = v1 if v2 > topValue: topValue = v2 if v3 > topValue: topValue = v3 bottomValue = v1 if v2 < bottomValue and v2 != -1: bottomValue = v2 if v3 < bottomValue and v3 != -1: bottomValue = v3 while topValue >= bottomValue: grid.AppendRows(1) grid.SetCellValue(row, col, "For " + unichr(163) + ('%.2f' % topValue)) grid.SetCellFont( row, col, wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) grid.SetCellBackgroundColour(row, col, wx.Colour(240, 240, 240)) grid.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_TOP) topValue -= decrement row += 1 grid.EnableEditing(False) grid.Bind(gr.EVT_GRID_SELECT_CELL, self.OnCellSelect) hbox2.Add(grid, flag=wx.GROW | wx.ALL, proportion=1) vbox.Add(hbox2, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=10, proportion=1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) font = wx.Font(22, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD) self.buttonConfirm = wx.Button(panel, label="CONFIRM") self.buttonConfirm.SetFont(font) self.buttonConfirm.Bind(wx.EVT_BUTTON, self.OnButtonConfirmClick) self.buttonConfirm.Disable() buttonNext = wx.Button(panel, label="NEXT") buttonNext.SetFont(font) buttonNext.Bind(wx.EVT_BUTTON, self.OnButtonNextClick) buttonClear = wx.Button(panel, label="CLEAR") buttonClear.SetFont(font) buttonClear.Bind(wx.EVT_BUTTON, self.OnButtonClearCLick) buttonPrev = wx.Button(panel, label="PREV") buttonPrev.SetFont(font) buttonPrev.Bind(wx.EVT_BUTTON, self.OnButtonPrevClick) self.buttonCon = wx.Button(panel, label="CONFIRM") self.buttonCon.SetFont(font) self.buttonCon.Bind(wx.EVT_BUTTON, self.OnButtonNextClick) self.buttonCon.Disable() if self.type == self.TYPE_EXAMPLE: leftBox = wx.BoxSizer(wx.VERTICAL) leftBox.Add(buttonPrev, flag=wx.ALIGN_LEFT) rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonNext, flag=wx.ALIGN_RIGHT) hbox3.Add(leftBox, flag=wx.ALIGN_LEFT, proportion=1) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT, proportion=1) self.buttonConfirm.Hide() buttonClear.Hide() self.buttonCon.Hide() elif self.type == self.TYPE_DEMO: rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonNext, flag=wx.ALIGN_RIGHT) centerBox = wx.BoxSizer(wx.VERTICAL) centerBox.Add(self.buttonConfirm, flag=wx.EXPAND | wx.ALIGN_CENTER) leftBox = wx.BoxSizer(wx.VERTICAL) leftBox.Add(buttonPrev, flag=wx.ALIGN_LEFT) hbox3.Add(leftBox, flag=wx.ALIGN_LEFT) hbox3.Add(centerBox, flag=wx.ALIGN_CENTRE, proportion=1) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT) buttonClear.Hide() self.buttonCon.Hide() for row in range(0, grid.GetNumberRows(), 1): for col in range(1, grid.GetNumberCols(), 1): grid.SetCellValue(row, col, "") grid.SetCellBackgroundColour(row, col, self.inactiveColor) if NUM_OF_COLS == 3: for row in range(0, 21, 1): grid.SetCellValue(row, 1, "") grid.SetCellBackgroundColour(row, 1, self.selectedColor) for row in range(21, 35, 1): grid.SetCellValue(row, 2, "") grid.SetCellBackgroundColour(row, 2, self.selectedColor) for row in range(35, grid.GetNumberRows(), 1): grid.SetCellValue(row, 3, "") grid.SetCellBackgroundColour(row, 3, self.selectedColor) elif NUM_OF_COLS == 5: for row in range(0, 8, 1): grid.SetCellValue(row, 1, "") grid.SetCellBackgroundColour(row, 1, self.selectedColor) for row in range(8, 13, 1): grid.SetCellValue(row, 2, "") grid.SetCellBackgroundColour(row, 2, self.selectedColor) for row in range(13, 17, 1): grid.SetCellValue(row, 3, "") grid.SetCellBackgroundColour(row, 3, self.selectedColor) for row in range(17, 20, 1): grid.SetCellValue(row, 4, "") grid.SetCellBackgroundColour(row, 4, self.selectedColor) for row in range(20, grid.GetNumberRows(), 1): grid.SetCellValue(row, 5, "") grid.SetCellBackgroundColour(row, 5, self.selectedColor) elif self.type == self.TYPE_DEMO2: rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonNext, flag=wx.ALIGN_RIGHT) centerBox = wx.BoxSizer(wx.VERTICAL) centerBox.Add(self.buttonConfirm, flag=wx.EXPAND | wx.ALIGN_CENTER) leftBox = wx.BoxSizer(wx.VERTICAL) leftBox.Add(buttonPrev, flag=wx.ALIGN_LEFT) hbox3.Add(leftBox, flag=wx.ALIGN_LEFT) hbox3.Add(centerBox, flag=wx.ALIGN_CENTRE, proportion=1) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT) buttonClear.Hide() self.buttonCon.Hide() for row in range(0, grid.GetNumberRows(), 1): for col in range(1, grid.GetNumberCols(), 1): grid.SetCellValue(row, col, "") grid.SetCellBackgroundColour(row, col, self.inactiveColor) if NUM_OF_COLS == 3: for row in range(0, 15, 1): grid.SetCellValue(row, 1, "") grid.SetCellBackgroundColour(row, 1, self.selectedColor) for row in range(15, 31, 1): grid.SetCellValue(row, 2, "") grid.SetCellBackgroundColour(row, 2, self.selectedColor) for row in range(31, 39, 1): grid.SetCellValue(row, 1, "") grid.SetCellBackgroundColour(row, 1, self.selectedColor) for row in range(39, 49, 1): grid.SetCellValue(row, 2, "") grid.SetCellBackgroundColour(row, 2, self.selectedColor) for row in range(49, grid.GetNumberRows(), 1): grid.SetCellValue(row, 3, "") grid.SetCellBackgroundColour(row, 3, self.selectedColor) elif NUM_OF_COLS == 5: for row in range(0, 8, 1): grid.SetCellValue(row, 1, "") grid.SetCellBackgroundColour(row, 1, self.selectedColor) for row in range(8, 13, 1): grid.SetCellValue(row, 2, "") grid.SetCellBackgroundColour(row, 2, self.selectedColor) for row in range(13, 17, 1): grid.SetCellValue(row, 3, "") grid.SetCellBackgroundColour(row, 3, self.selectedColor) for row in range(17, 20, 1): grid.SetCellValue(row, 4, "") grid.SetCellBackgroundColour(row, 4, self.selectedColor) for row in range(20, grid.GetNumberRows(), 1): grid.SetCellValue(row, 5, "") grid.SetCellBackgroundColour(row, 5, self.selectedColor) elif self.type == self.TYPE_PRACTICE: centerBox = wx.BoxSizer(wx.VERTICAL) centerBox.Add(self.buttonCon, flag=wx.EXPAND | wx.ALIGN_CENTER) hbox3.Add(centerBox, flag=wx.ALIGN_CENTRE, proportion=1) rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonClear, flag=wx.ALIGN_RIGHT) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT) buttonNext.Hide() buttonPrev.Hide() self.buttonConfirm.Hide() elif self.type == self.TYPE_REAL: centerBox = wx.BoxSizer(wx.VERTICAL) centerBox.Add(self.buttonConfirm, flag=wx.EXPAND | wx.ALIGN_CENTER) hbox3.Add(centerBox, flag=wx.ALIGN_CENTRE, proportion=1) rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonClear, flag=wx.ALIGN_RIGHT) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT) buttonNext.Hide() buttonPrev.Hide() self.buttonCon.Hide() elif self.type == self.TYPE_REAL_FINAL: self.buttonConfirm.SetLabel("FINISH THE EXPERIMENT") centerBox = wx.BoxSizer(wx.VERTICAL) centerBox.Add(self.buttonConfirm, flag=wx.EXPAND | wx.ALIGN_CENTER) hbox3.Add(centerBox, flag=wx.ALIGN_CENTRE, proportion=1) rightBox = wx.BoxSizer(wx.VERTICAL) rightBox.Add(buttonClear, flag=wx.ALIGN_RIGHT) hbox3.Add(rightBox, flag=wx.ALIGN_RIGHT) buttonNext.Hide() buttonPrev.Hide() self.buttonCon.Hide() panel.SetSizer(vbox) vbox.Add(hbox3, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=8) ###Resize columns grid.SetDefaultCellOverflow(True) grid.SetDefaultEditor(wx.grid.GridCellAutoWrapStringEditor()) grid.AutoSizeColumns() for col in range(1, grid.GetNumberCols(), 1): grid.SetCellOverflow(0, col, True) total = 0 widestCol = 0 for col in range(1, grid.GetNumberCols(), 1): if widestCol < grid.GetColSize(col): widestCol = grid.GetColSize(col) for col in range(1, grid.GetNumberCols(), 1): grid.SetColSize(col, widestCol) grid.DisableDragColSize() grid.DisableDragRowSize()
def __init_resources(): global __res __res = xrc.EmptyXmlResource() wx.FileSystem.AddHandler(wx.MemoryFSHandler()) EMA_startup_window_xrc = '''\ <?xml version="1.0" ?> <resource> <object class="wxFrame" name="HEAD"> <object class="wxMenuBar" name="MEN_BAR"/> <object class="wxToolBar"> <object class="wxButton" name="BTN_OUTPUT"> <label>Select output file</label> <style>wxNO_BORDER</style> <bg>#80FF80</bg> </object> <object class="wxButton" name="BTN_RUN"> <label>Run script</label> <style>wxBU_EXACTFIT|wxNO_BORDER</style> <bg>#FF8080</bg> <enabled>1</enabled> </object> </object> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="wxStaticLine"> <style>wxLI_HORIZONTAL</style> </object> <flag>wxEXPAND</flag> </object> <object class="sizeritem"> <object class="wxPanel"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxBoxSizer"> <object class="sizeritem"> <object class="wxStaticText"> <label>Data output filename:</label> <style>wxALIGN_LEFT</style> </object> <flag>wxALIGN_LEFT</flag> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="TXT_FILENAME"> <value><choose the filename with button></value> <style>wxTE_READONLY</style> </object> <flag>wxALL|wxEXPAND|wxGROW|wxALIGN_LEFT|wxADJUST_MINSIZE</flag> <minsize>350,20</minsize> </object> <orient>wxHORIZONTAL</orient> </object> </object> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxHORIZONTAL</orient> <object class="sizeritem"> <object class="wxStaticText"> <label>Working directory:</label> </object> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="TXT_DIRECTORY"> <value><choose the filename with button></value> <style>wxTE_READONLY</style> </object> <flag>wxALL|wxEXPAND|wxGROW|wxALIGN_LEFT|wxADJUST_MINSIZE</flag> <minsize>350,20</minsize> </object> </object> </object> </object> </object> </object> <object class="sizeritem"> <object class="wxStaticLine"/> </object> <object class="sizeritem"> <object class="wxPanel" name="PNL_SCRIPT_SELECT"> <object class="wxBoxSizer"> <orient>wxHORIZONTAL</orient> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxStaticText" name="TXT_CATEGORIES"> <label>Categories of scripts</label> </object> </object> <object class="sizeritem"> <object class="wxListCtrl" name="LST_CATEGORIES"> <size>250,100</size> <style>wxLC_LIST|wxLC_SINGLE_SEL|wxLC_VRULES</style> </object> </object> </object> </object> <object class="sizeritem"> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <object class="wxStaticText" name="TXT_SCRIPTS"> <label>Select testing script</label> </object> </object> <object class="sizeritem"> <object class="wxListCtrl" name="LST_SCRIPTS"> <size>250,100</size> <style>wxLC_LIST|wxLC_SINGLE_SEL|wxLC_VRULES</style> </object> </object> </object> </object> </object> </object> </object> <object class="sizeritem"> <object class="wxPanel" name="PNL_PARAM_EDIT"> <style/> </object> <flag>wxTOP|wxALL|wxEXPAND|wxGROW</flag> </object> <object class="sizeritem"> <object class="wxTextCtrl" name="TXT_DESRIPTION"> <size>500,200</size> <style>wxTE_AUTO_SCROLL|wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP</style> </object> <flag>wxALL|wxEXPAND|wxGROW</flag> </object> <orient>wxVERTICAL</orient> </object> <size>500,500</size> <title>EMA - Electrical measurement apparate control</title> <centered>1</centered> </object> </resource>''' wx.MemoryFSHandler.AddFile('XRC/EMA_startup_window/EMA_startup_window_xrc', EMA_startup_window_xrc) __res.Load('memory:XRC/EMA_startup_window/EMA_startup_window_xrc')