def __init__(self, parent, ID, log): wx.Panel.__init__(self, parent, ID) self.log = log self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), changeCallback=self.fbbCallback) self.fbbh = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(450, -1), changeCallback=self.fbbhCallback) self.dbb = filebrowse.DirBrowseButton(self, -1, size=(450, -1), changeCallback=self.dbbCallback) self.fbbh.callCallback = False self.fbbh.SetHistory( ['You', 'can', 'put', 'some', 'filenames', 'here'], 4) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.fbb, 0, wx.ALL, 5) sizer.Add(self.fbbh, 0, wx.ALL, 5) sizer.Add(self.dbb, 0, wx.ALL, 5) box = wx.BoxSizer() box.Add(sizer, 0, wx.ALL, 20) self.SetSizer(box)
def __init__(self, parent, size=(300,300)): wx.Panel.__init__(self, parent) self.quote = wx.StaticText(self, label="Result:", pos=(20, 100)) self.result = wx.TextCtrl(self, value="", pos=(20, 120)) # # A multiline TextCtrl - This is here to show how the events work in this program, don't pay too much attention to it # self.logger = wx.TextCtrl(self, pos=(300,20), size=(200,300), style=wx.TE_MULTILINE | wx.TE_READONLY) # A button self.button = wx.Button(self, label="Find the Causal Direction!", pos=(200, 85)) self.Bind(wx.EVT_BUTTON, self.OnClick,self.button) # the edit control - one line version. # self.lblname = wx.StaticText(self, label="Your name :", pos=(20,60)) # self.editname = wx.TextCtrl(self, value="Enter here your name", pos=(150, 60), size=(140,-1)) # self.Bind(wx.EVT_TEXT, self.EvtText, self.editname) # self.Bind(wx.EVT_CHAR, self.EvtChar, self.editname) # self.X_browse_file = filebrowsebutton.FileBrowseButtonWithHistory(self, labelText='Enter the location for the X time Series:', pos=(10,30)) self.Y_browse_file = filebrowsebutton.FileBrowseButtonWithHistory(self, labelText='Enter the location for the Y time Series:', pos=(10,50))
def __init__(self, db3Path, xmlPath, parent): pre = wx.PreDialog() pre.Create(parent, title = 'Convert mangalore level from .db3 to .xml') self.PostCreate(pre) db3WildCard = 'SQLite datebase file (*.db3)|*.db3|All files (*.*)|*.*' xmlWildCard = 'Mangalore XML file (*.xml)|*.xml|All files (*.*)|*.*' if os.path.isdir(db3Path): self.db3FileBrowse = filebrowse.FileBrowseButtonWithHistory(self, labelText = 'Mangalore level .db3 file:', startDirectory = db3Path, fileMask = db3WildCard) else: self.db3FileBrowse = filebrowse.FileBrowseButtonWithHistory(self, labelText = 'Mangalore level .db3 file:', initialValue = db3Path, fileMask = db3WildCard) if os.path.isdir(xmlPath): self.xmlFileBrowse = filebrowse.FileBrowseButtonWithHistory(self, labelText = 'Mangalore level .xml file:', startDirectory = xmlPath, fileMask = xmlWildCard) else: self.xmlFileBrowse = filebrowse.FileBrowseButtonWithHistory(self, labelText = 'Mangalore level .xml file:', initialValue = xmlPath, fileMask = xmlWildCard) line = wx.StaticLine(self, size = (300, -1)) okBtn = wx.Button(self, wx.ID_OK) cancelBtn = wx.Button(self, wx.ID_CANCEL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.db3FileBrowse, 1, wx.ALIGN_RIGHT | wx.ALL, 10) sizer.Add(self.xmlFileBrowse, 1, wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT | wx.DOWN, 10) sizer.Add(line, 0, wx.LEFT | wx.RIGHT, 20) bsizer = wx.StdDialogButtonSizer() bsizer.AddButton(okBtn) bsizer.AddButton(cancelBtn) bsizer.Realize() sizer.Add(bsizer, 0, wx.ALIGN_CENTER | wx.ALL, 15) self.SetSizer(sizer) sizer.Fit(self) #------------------------------------------------------------------------------- # Eof #-------------------------------------------------------------------------------
def _createInterface(self, parent, params): pcd = params.getParam(parameters.CurrentDatabasePath) sizer = wx.BoxSizer( wx.VERTICAL ) box = wx.StaticBoxSizer(wx.StaticBox( parent, -1, "" ) , wx.VERTICAL ) #### current database info ### hbox = wx.BoxSizer( wx.HORIZONTAL ) label = wx.StaticText(parent, -1, pcd.getDescription() ) textctrl = wx.TextCtrl(parent, -1, pcd.getValue()) textctrl.SetEditable(False) hbox.Add(label, 0, wx.ALIGN_CENTRE_VERTICAL) hbox.AddSpacer(5) hbox.Add(textctrl, 1, wx.ALIGN_CENTRE_VERTICAL|wx.EXPAND) box.Add( hbox, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTRE_VERTICAL|wx.EXPAND, 5 ) #### available dbs ### default_db = params.getParam(parameters.DefaultDatabase).getValue() hbox = wx.BoxSizer( wx.HORIZONTAL ) path = self.getParamsMgr().getChemistryDatabasePath() dbs = self._fetchAvailableDatabases(path) hbox.Add(wx.StaticText(parent, -1, "Available Database" ), 0, wx.ALIGN_CENTRE_VERTICAL) choice = wx.Choice(parent, -1, choices=dbs) choice.Bind(wx.EVT_CHOICE , lambda e : self.setFileToImport(os.path.join(path, choice.GetStringSelection()), 1) ) index = -1 try: index = dbs.index(default_db) except: pass if index >= 0: choice.SetSelection( index ) hbox.AddSpacer(5) hbox.Add(choice, 1, wx.ALIGN_CENTRE_VERTICAL) box.Add( hbox, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTRE_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) #### database to import ### import_box = wx.StaticBoxSizer(wx.StaticBox( parent, -1, "Database to import" ) , wx.VERTICAL ) self.fbbh = filebrowse.FileBrowseButtonWithHistory(parent, -1 , labelText="file to import" , changeCallback = self.fbbhCallback , fileMask = "*" + parameters.CHEMISTRY_DB_EXTENSION) import_box.Add(self.fbbh, 1, wx.EXPAND) box.Add( import_box, 1, wx.EXPAND, 5 ) sizer.Add( box, 0, wx.ALIGN_CENTRE|wx.ALL| wx.EXPAND, 5 ) parent.SetSizerAndFit(sizer)
def __init__(self, parent, ID, log): wx.Panel.__init__(self, parent, ID) self.log = log self.fbb = filebrowse.FileBrowseButton(self, -1, (20, 20), (450, -1), changeCallback=self.fbbCallback) self.fbbh = filebrowse.FileBrowseButtonWithHistory( self, -1, (20, 50), (450, -1), changeCallback=self.fbbhCallback) self.dbb = filebrowse.DirBrowseButton(self, -1, (20, 80), (450, -1), changeCallback=self.dbbCallback) self.fbbh.SetHistory( ['You', 'can', 'put', 'some', 'filenames', 'here'])
def __init__(self, *args, **kwds): # begin wxGlade: PAIMEIfilefuzz.__init__ kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.list_book = kwds["parent"] # handle to list book. self.pydbg = copy.copy( self.list_book.top.pydbg) # handle to top most frame. self.main_splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D | wx.SP_BORDER) self.log_window_pane = wx.Panel(self.main_splitter, -1) self.main_window_pane = wx.Panel(self.main_splitter, -1) self.setup_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1, "Setup") self.setup_right_staticbox = wx.StaticBox(self.main_window_pane, -1, "Byte Modifications") self.file_inspector_staticbox = wx.StaticBox(self.main_window_pane, -1, "File Inspector") self.progress_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1, "Progress") self.statistics_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1, "Statistics") self.fuzz_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1, "Fuzz") self.program_name_label = wx.StaticText(self.main_window_pane, -1, "Program Name") self.program_name_control = filebrowse.FileBrowseButtonWithHistory( self.main_window_pane, -1, size=(500, -1), labelText="") self.program_name_control.SetHistory([]) self.source_name_label = wx.StaticText(self.main_window_pane, -1, "Source File Name") self.source_name_control = filebrowse.FileBrowseButtonWithHistory( self.main_window_pane, -1, size=(500, -1), labelText="") self.source_name_control.SetHistory([]) self.destination_label = wx.StaticText(self.main_window_pane, -1, "Destination Directory") self.destination_control = filebrowse.DirBrowseButton( self.main_window_pane, -1, size=(500, -1), labelText="") self.hex_label = wx.StaticText(self.main_window_pane, -1, "Hex Bytes") self.hex_control = wx.TextCtrl(self.main_window_pane, -1, "") self.start_label = wx.StaticText(self.main_window_pane, -1, "Range Start") self.start_control = wx.TextCtrl(self.main_window_pane, -1, "") self.start_control.SetMaxLength(7) self.end_label = wx.StaticText(self.main_window_pane, -1, "Range End") self.end_control = wx.TextCtrl(self.main_window_pane, -1, "") self.end_control.SetMaxLength(7) self.timeout_label = wx.StaticText(self.main_window_pane, -1, "Timeout (secs)") self.timer_control = wx.TextCtrl(self.main_window_pane, -1, "") self.timer_control.SetMaxLength(7) self.file_view_control = wx.TextCtrl(self.main_window_pane, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2) self.file_list_box_control = wx.ListBox(self.main_window_pane, -1, choices=[], style=wx.LB_SINGLE) self.file_list_refresh_button = wx.Button(self.main_window_pane, -1, "Refresh List") self.generate_button_control = wx.Button(self.main_window_pane, -1, "Generate") self.run_button_control = wx.Button(self.main_window_pane, -1, "Run") self.stop_button_control = wx.Button(self.main_window_pane, -1, "Stop") self.stat_crashes_label = wx.StaticText(self.main_window_pane, -1, "# Crashes:") self.stat_crashes = wx.StaticText(self.main_window_pane, -1, "0 / 0%", style=wx.ALIGN_RIGHT) self.stat_num_read_label = wx.StaticText(self.main_window_pane, -1, "# Read Violations:") self.stat_num_read = wx.StaticText(self.main_window_pane, -1, "0 / 0%", style=wx.ALIGN_RIGHT) self.stat_num_write_label = wx.StaticText(self.main_window_pane, -1, "# Write Violations:") self.stat_num_write = wx.StaticText(self.main_window_pane, -1, "0 / 0%", style=wx.ALIGN_RIGHT) self.stat_running_time_label = wx.StaticText(self.main_window_pane, -1, "Running Time:") self.stat_running_time = wx.StaticText(self.main_window_pane, -1, "00:00:00", style=wx.ALIGN_RIGHT) self.stat_end_eta_label = wx.StaticText(self.main_window_pane, -1, "Estimated Completion:") self.stat_end_eta = wx.StaticText(self.main_window_pane, -1, "00:00:00", style=wx.ALIGN_RIGHT) self.stat_last_violaton_label = wx.StaticText( self.main_window_pane, -1, "Last Violation Address:") self.stat_last_violation = wx.StaticText(self.main_window_pane, -1, "N/A", style=wx.ALIGN_RIGHT) self.progress_text_label = wx.StaticText(self.main_window_pane, -1, "File 0 / 0") self.progress_gauge_control = wx.Gauge(self.main_window_pane, -1, 100, style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) self.log = wx.TextCtrl(self.log_window_pane, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LINEWRAP) self.__set_properties() self.__do_layout() #self.Bind(wx.EVT_BUTTON, self.OnHistory, self.history_button_control) #self.Bind(wx.EVT_BUTTON, self.OnSave, self.save_button_control) #self.Bind(wx.EVT_BUTTON, self.OnLoad, self.Load) self.Bind(wx.EVT_LISTBOX, self.OnFileList, self.file_list_box_control) self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.file_list_refresh_button) self.Bind(wx.EVT_BUTTON, self.OnGenerate, self.generate_button_control) self.Bind(wx.EVT_BUTTON, self.OnRun, self.run_button_control) self.Bind(wx.EVT_BUTTON, self.OnStop, self.stop_button_control) # Thread events self.Bind(EVT_THREAD_UPDATE, self.OnThreadUpdate) self.Bind(EVT_THREAD_LOG, self.OnThreadLog) self.Bind(EVT_THREAD_END, self.OnThreadEnd) self.msg("PaiMei File Fuzz") self.msg("Module by Cody Pierce\n")
def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)): wx.Frame.__init__(self, parent, id, title, size=size) self.SetBackgroundColour(wx.Colour(240, 240, 240)) self.fname = None self.updated = False self.firstTime = True self.lastUpdateTime = None self.comments = [] self.filehistory = wx.FileHistory(16) self.config = wx.Config(appName="StageRaceGC", vendorName="*****@*****.**", style=wx.CONFIG_USE_LOCAL_FILE) self.filehistory.Load(self.config) inputBox = wx.StaticBox(self, label=_('Input')) inputBoxSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL) self.fileBrowse = filebrowse.FileBrowseButtonWithHistory( self, labelText=_('Excel File'), buttonText=('Browse...'), startDirectory=os.path.expanduser('~'), fileMask= 'Excel Spreadsheet (*.xlsx; *.xlsm; *.xls)|*.xlsx; *.xlsml; *.xls', size=(400, -1), history=lambda: [ self.filehistory.GetHistoryFile(i) for i in xrange(self.filehistory.GetCount()) ], changeCallback=self.doChangeCallback, ) inputBoxSizer.Add(self.fileBrowse, 0, flag=wx.EXPAND | wx.ALL, border=4) horizontalControlSizer = wx.BoxSizer(wx.HORIZONTAL) self.updateButton = RoundButton(self, size=(96, 96)) self.updateButton.SetLabel(_('Update')) self.updateButton.SetFontToFitLabel() self.updateButton.SetForegroundColour(wx.Colour(0, 100, 0)) self.updateButton.Bind(wx.EVT_BUTTON, self.doUpdate) horizontalControlSizer.Add(self.updateButton, flag=wx.ALL, border=4) horizontalControlSizer.AddSpacer(48) vs = wx.BoxSizer(wx.VERTICAL) self.tutorialButton = wx.Button(self, label=_('Help/Tutorial...')) self.tutorialButton.Bind(wx.EVT_BUTTON, self.onTutorial) vs.Add(self.tutorialButton, flag=wx.ALL, border=4) branding = wx.adv.HyperlinkCtrl( self, id=wx.ID_ANY, label=u"Powered by CrossMgr", url=u"http://www.sites.google.com/site/crossmgrsoftware/") vs.Add(branding, flag=wx.ALL, border=4) horizontalControlSizer.Add(vs) self.openExcel = wx.Button(self, label=_('Open Excel File...')) self.openExcel.Bind(wx.EVT_BUTTON, self.onOpenExcel) horizontalControlSizer.AddSpacer(48) horizontalControlSizer.Add(self.openExcel, flag=wx.ALIGN_RIGHT | wx.ALL, border=4) inputBoxSizer.Add(horizontalControlSizer, flag=wx.EXPAND) self.stageList = ListMixCtrl(self, style=wx.LC_REPORT, size=(-1, 160)) self.stageList.InsertColumn(0, "Sheet") self.stageList.InsertColumn(1, "Bibs", wx.LIST_FORMAT_RIGHT) self.stageList.InsertColumn(2, "Errors/Warnings") self.stageList.setResizeColumn(2) bookStyle = (flatnotebook.FNB_NO_X_BUTTON | flatnotebook.FNB_FF2 | flatnotebook.FNB_NODRAG | flatnotebook.FNB_DROPDOWN_TABS_LIST | flatnotebook.FNB_NO_NAV_BUTTONS | flatnotebook.FNB_BOTTOM) self.notebook = flatnotebook.FlatNotebook(self, 1000, agwStyle=bookStyle) self.notebook.SetBackgroundColour(wx.WHITE) self.saveAsExcelButton = wx.Button(self, label=u'Save as Excel') self.saveAsExcelButton.Bind(wx.EVT_BUTTON, self.saveAsExcel) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(inputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4) mainSizer.Add(self.stageList, flag=wx.EXPAND | wx.ALL, border=4) mainSizer.Add(self.notebook, 1, flag=wx.EXPAND | wx.ALL, border=4) mainSizer.Add(self.saveAsExcelButton, flag=wx.ALL, border=4) self.SetSizer(mainSizer)
def __init__(self, *args, **kwds): # begin wxGlade: ChooseVaultFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self._lb_passwd = wx.StaticText(self.panel_1, -1, _("Password") + ":") self._tc_passwd = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_PASSWORD) self.bitmap_1 = wx.StaticBitmap( self.panel_1, -1, wx.Bitmap(os.path.join(get_resourcedir(), "loxodo-icon.png"), wx.BITMAP_TYPE_ANY)) self._fb_filename = filebrowsebutton.FileBrowseButtonWithHistory( self.panel_1, -1, size=(450, -1), changeCallback=self._on_pickvault, labelText=_("Vault") + ":") if (config.recentvaults): self._fb_filename.SetHistory(config.recentvaults, 0) self.static_line_1 = wx.StaticLine(self.panel_1, -1) self.SetTitle("Loxodo - " + _("Open Vault")) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_3.Add( self.bitmap_1, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) sizer_3.Add(self._fb_filename, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_5.Add(self._lb_passwd, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer_5.Add(self._tc_passwd, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) sizer_3.Add(sizer_5, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) sizer_3.Add(self.static_line_1, 0, wx.TOP | wx.EXPAND, 10) btnsizer = wx.BoxSizer(wx.HORIZONTAL) btn = wx.Button(self.panel_1, wx.ID_NEW) wx.EVT_BUTTON(self, wx.ID_NEW, self._on_new) btnsizer.Add(btn, 0, wx.TOP | wx.RIGHT, 10) btn = wx.Button(self.panel_1, wx.ID_OPEN) wx.EVT_BUTTON(self, wx.ID_OPEN, self._on_open) btn.SetDefault() btnsizer.Add(btn, 0, wx.TOP | wx.RIGHT, 10) sizer_3.Add(btnsizer, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 5) self.panel_1.SetSizer(sizer_3) sizer_2.Add(self.panel_1, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_2) sizer_2.Fit(self) self.Layout() self.SetMinSize(self.GetSize()) self.SetMaxSize((-1, self.GetSize().height)) self._tc_passwd.SetFocus()
def __init__(self): setBaseDB('dass.db') initializeBaseDB() def makeSP(name, labels, statictexts = None): panel = wx.Panel(self.sidePanel, -1) box = wx.StaticBox(panel,-1, name) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) panel.rangeValue = {} for name, min_value, value, max_value in labels: sp = SpinPanel(panel, name, min_value, value, max_value, self.OnSpinback) panel.rangeValue[name] = sp sizer.Add(sp, 0, wx.EXPAND) print "done" panel.SetSizer(sizer) return panel wx.Frame.__init__(self, None, title = "CLUSTERING ALGORITHM") ################ Adding Drawing Panel ################ self.displayPanel = DisplayPanel(self) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.axes.set_axis_bgcolor('white') self.canvas = Canvas(self.displayPanel, -1, self.figure) ################ Connecting the canvas to events for selecting intial centroid & nuclei ################### self.figure.canvas.mpl_connect('button_press_event', self.onGraphClick) self.figure.canvas.mpl_connect('pick_event', self.onNucleiPick) ################ Connecting the canvas to events for selecting intial centroid & nuclei ################### sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.canvas, 1, wx.EXPAND) self.displayPanel.SetSizer(sizer) self.displayPanel.Fit() self.toolbar = NavigationToolbar(self.canvas) self.SetToolBar(self.toolbar) self.toolbar.Realize() tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() self.toolbar.SetSize(wx.Size(fw, th)) self.toolbar.update() self.redraw_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_redraw_timer, self.redraw_timer) self.stopStart = threading.Event() self.data = None self.centroids = [] self.clusterIds = None self.colors = None self.k = 0 self.iterTimer = 0 self.iterations = 20 self.sidePanel = wx.Panel(self) self.pointToPick = 0 self.selectedFeaturesCount = 0 self.isPickCentroids = False ################ Adding Drawing Panel ################ ################ defining features for clustering algorithm ################ self.dictionary = {'Area':'AREA', 'Perimeter':'PERIMETER', 'Roundness':'ROUNDNESS','Equi-Diameter':'EQUI_DIAMETER', 'Orientation':'ORIENTATION', 'Convex Area':'CONVEX_AREA', 'Solidity': 'SOLIDITY', 'Major Axis':'MAJOR_AXIS_LEN','Minor Axis': 'MINOR_AXIS_LEN', 'Eccentricity':'ECCENTRICITY', 'Min Enclosing Rad':'CIR_RADIUS', 'Shape Index':'SHAPE_INDEX','Border Index':'BORDER_INDEX','Aspect Ratio':'ASPECT_RATION', 'Mean Pixel Intensity':'MEAN_PIXEL_DEN', 'Max Pixel Intensity':'MAX_PIXEL_DEN','Min Pixel Intensity':'MIN_PIXEL_DEN' } featureList = ['Area', 'Perimeter', 'Roundness', 'Equi-Diameter','Orientation', 'Convex Area', 'Solidity', 'Major Axis', 'Minor Axis', 'Eccentricity','Min Enclosing Rad','Shape Index','Border Index','Aspect Ratio', 'Mean Pixel Intensity','Max Pixel Intensity', 'Min Pixel Intensity'] ################ defining features for clustering algorithm ################ ################ Adding File Open Dialog to Show the tiles Info ################ self.chooseImagePanel = wx.Panel(self.sidePanel, -1) box = wx.StaticBox(self.chooseImagePanel, -1, 'Choose Image') self.subPanel = wx.Panel(self.chooseImagePanel, -1) sizer = wx.BoxSizer(wx.VERTICAL) self.filebrowser = filebrowse.FileBrowseButtonWithHistory( self.subPanel, -1, size=(450, -1), changeCallback = self.updateHistory) button = wx.Button(self.subPanel, -1, "View Image") button.Bind(wx.EVT_BUTTON, self.viewImage) sizer.Add(self.filebrowser,0,wx.EXPAND) sizer.Add(button,0,wx.ALL|wx.RIGHT|wx.ALIGN_RIGHT,5) self.subPanel.SetSizer(sizer) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) sizer.Add(self.subPanel) self.chooseImagePanel.SetSizer(sizer) ################ Adding File Open Dialog to Show the tiles Info ################ ################ Adding Algorithm Options Info ################ self.algorithmPanel = wx.Panel(self.sidePanel, -1) box = wx.StaticBox(self.algorithmPanel, -1, 'Algorithms') self.subPanel = wx.Panel(self.algorithmPanel, -1) sizer = wx.BoxSizer(wx.HORIZONTAL) self.algorithm1 = wx.RadioButton(self.subPanel, label="K-MEANS", style = wx.RB_GROUP) self.algorithm2 = wx.RadioButton(self.subPanel, label="OPTICS") self.algorithm1.Bind(wx.EVT_RADIOBUTTON, self.kmeansSelected) self.algorithm2.Bind(wx.EVT_RADIOBUTTON, self.opticsSelected) sizer.Add(self.algorithm1 ,0,wx.ALL|wx.RIGHT|wx.ALIGN_LEFT, 5) sizer.Add((1,1),1) sizer.Add((1,1),1) sizer.Add(self.algorithm2 ,1,wx.ALL|wx.RIGHT|wx.ALIGN_RIGHT,5) self.subPanel.SetSizer(sizer) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) sizer.Add(self.subPanel) self.algorithmPanel.SetSizer(sizer) ################ Adding Algorithm Options Info ################ ################ Adding Features Panel ################ self.featuresPanel = wx.Panel(self.sidePanel, -1) box = wx.StaticBox(self.featuresPanel, -1, 'Features') self.subPanel = wx.Panel(self.featuresPanel, -1) sizer = wx.GridSizer(rows = 6, cols = 3) global featureCB for feature in featureList: cb = wx.CheckBox(self.subPanel, label=feature) cb.Bind(wx.EVT_CHECKBOX, self.featuresSelected) featureCB[feature] = cb sizer.Add(cb, 0, wx.BOTTOM|wx.LEFT, 2) self.subPanel.SetSizer(sizer) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) sizer.Add(self.subPanel) self.featuresPanel.SetSizer(sizer) ################ Adding Features Panel ################ ################ Adding Feature1, Feature2 Range Value ################ self.feature1 = makeSP('FEATURE 1 RANGES', (('Minimum', 1, 1, 3600), ('Maximum', 1, 3600, 3600))) self.feature2 = makeSP('FEATURE 2 RANGES', (('Minimum', 1, 1, 3600), ('Maximum', 1, 3600, 3600))) ################ Adding Feature1, Feature2 Range Value ################ ################ Adding all the panels to the main window ################ self.optionPanel = OptionsPanel(self,self.sidePanel, self.displayPanel) self.buttonStart = wx.Button(self.sidePanel, -1, "Start") self.buttonStart.Bind(wx.EVT_BUTTON, self.startProcess) buttonClose = wx.Button(self.sidePanel, -1, "Close") buttonClose.Bind(wx.EVT_BUTTON, self.stopProcess) self.buttonGenerate = wx.Button(self.sidePanel, -1, "Generate Image") self.buttonGenerate.Bind(wx.EVT_BUTTON, self.generateImage) self.buttonReset = wx.Button(self.sidePanel, -1, "Show Image/Reset") self.buttonReset.Bind(wx.EVT_BUTTON, self.resetProcess) self.feature1.Enable(False) self.feature2.Enable(False) self.buttonStart.Enable(False) self.buttonGenerate.Enable(False) self.algorithmPanel.Enable(False) self.optionPanel.Enable(False) self.buttonReset.Enable(False) panelSizer = wx.BoxSizer(wx.VERTICAL) panelSizer.Add(self.chooseImagePanel, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) panelSizer.Add(self.featuresPanel, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) panelSizer.Add(self.feature1, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) panelSizer.Add(self.feature2, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) panelSizer.Add(self.algorithmPanel, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) panelSizer.Add(self.optionPanel, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.buttonStart ,0,wx.ALL|wx.RIGHT|wx.ALIGN_LEFT, 5) # sizer.Add((1,1),1) sizer.Add(self.buttonGenerate ,0,wx.ALL|wx.RIGHT|wx.ALIGN_CENTER,5) # sizer.Add((1,1),1) sizer.Add(self.buttonReset,0,wx.ALL|wx.RIGHT|wx.ALIGN_CENTER,5) sizer.Add(buttonClose ,0,wx.ALL|wx.RIGHT|wx.ALIGN_RIGHT,5) panelSizer.Add(sizer,0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) # panelSizer.Add(buttonStart, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) # panelSizer.Add(buttonClose, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5) self.sidePanel.SetSizer(panelSizer) mainSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(self.displayPanel, 1, wx.EXPAND) mainSizer.Add(self.sidePanel, 0, wx.EXPAND) self.SetSizer(mainSizer) mainSizer.Fit(self) rw, rh = self.displayPanel.GetSize() sw, sh = self.sidePanel.GetSize() fw, fh = self.GetSize() h = max(600, fh) w = h + fw - rw if verbose: print 'Display Panel Size', (rw, rh) print 'Side Panel Size', (sw, sh) print 'Frame Size', (fw, fh) self.SetSize((w,h)) self.Show()
def __init__(self, parent): # init BasicPanel.__init__(self, parent) # box: input boxinput = wx.BoxSizer(wx.VERTICAL) # reader self.readers = api_pcsc.getreaderlist() self.readercombo = wx.ComboBox(self, -1, '', (-1, -1), (-1, -1), map(str, self.readers), style=wx.CB_READONLY) self.readercombo.SetSelection(0) b = wx.Button(self, -1, u('复位'), (-1, -1)) self.Bind(wx.EVT_BUTTON, self.OnReset, b) boxreader = wx.BoxSizer(wx.HORIZONTAL) boxreader.Add(self.readercombo, 1, wx.EXPAND) boxreader.Add(b, 0, wx.EXPAND) # order boxinput.Add(boxreader, 0, wx.EXPAND) sb = wx.StaticBox(self, -1, u('XH工单号')) sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.order = wx.TextCtrl(sb, -1, 'XH20160102', size=(-1, -1)) sbsizer.Add(self.order, 1, wx.EXPAND | wx.ALL) boxinput.Add(sbsizer, 0, wx.EXPAND) # prd sb = wx.StaticBox(self, -1, u('prd数据文件')) sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.prd = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(170, -1), labelText='', buttonText=u('选择'), fileMask='*.prd', changeCallback=self.prdCallback) sbsizer.Add(self.prd, 1, wx.EXPAND | wx.ALL) boxinput.Add(sbsizer, 0, wx.EXPAND) boxiccidtest = wx.BoxSizer(wx.HORIZONTAL) # iccid sb = wx.StaticBox(self, -1, self.SN_Label) sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.iccid = wx.TextCtrl(sb, -1, self.SN_Value, size=(-1, -1), validator=HexdigitsValidator()) sbsizer.Add(self.iccid, 1, wx.EXPAND | wx.ALL) boxiccidtest.Add(sbsizer, 1, wx.EXPAND) # test b = wx.Button(self, -1, u('检测'), (-1, -1)) self.Bind(wx.EVT_BUTTON, self.OnTest, b) boxiccidtest.Add(b, 0, wx.EXPAND) boxinput.Add(boxiccidtest, 0, wx.EXPAND) # printer sb = wx.StaticBox(self, -1, u('期望版面')) sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.printer = PrinterPanel(sb) sbsizer.Add(self.printer, 0) #, wx.EXPAND|wx.ALL) boxinput.Add(sbsizer, 1, wx.EXPAND) # log window sb = wx.StaticBox(self, -1, u('检测日记')) sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.log = wx.richtext.RichTextCtrl(sb, -1, '', size=(-1, -1), style=wx.TE_DONTWRAP | wx.HSCROLL | wx.VSCROLL | wx.TE_READONLY | wx.TE_MULTILINE) sbsizer.Add(self.log, 1, wx.EXPAND | wx.ALL) boxloginput = wx.BoxSizer(wx.HORIZONTAL) boxloginput.Add(sbsizer, 2, wx.EXPAND | wx.ALL) boxloginput.Add(boxinput, 1, wx.EXPAND | wx.ALL) box = wx.BoxSizer(wx.VERTICAL) box.Add(boxloginput, 1, wx.EXPAND) # bind self.Bind(wx.EVT_COMBOBOX, self.OnSelectReader, self.readercombo) # finally self.SetSizer(box) self.GetBestSize()
def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)): wx.Frame.__init__(self, parent, id, title, size=size) self.SetBackgroundColour(wx.Colour(240, 240, 240)) self.fname = None self.updated = False self.firstTime = True self.lastUpdateTime = None self.sources = [] self.errors = [] self.filehistory = wx.FileHistory(16) dataDir = Utils.getHomeDir() configFileName = os.path.join(dataDir, 'CallupSeedingMgr.cfg') self.config = wx.Config(appName="CallupSeedingMgr", vendorName="SmartCyclingSolutions", localFilename=configFileName) self.filehistory.Load(self.config) ID_MENU_UPDATE = wx.NewIdRef() ID_MENU_HELP = wx.NewIdRef() self.menuBar = wx.MenuBar(wx.MB_DOCKABLE) if 'WXMAC' in wx.Platform: self.appleMenu = self.menuBar.OSXGetAppleMenu() self.appleMenu.SetTitle("CallupSeedingMgr") self.appleMenu.Insert(0, wx.ID_ABOUT, "&About") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.editMenu = wx.Menu() self.editMenu.Append( wx.MenuItem(self.editMenu, ID_MENU_UPDATE, "&Update")) self.Bind(wx.EVT_MENU, self.doUpdate, id=ID_MENU_UPDATE) self.menuBar.Append(self.editMenu, "&Edit") self.helpMenu = wx.Menu() self.helpMenu.Append( wx.MenuItem(self.helpMenu, ID_MENU_HELP, "&Help")) self.menuBar.Append(self.helpMenu, "&Help") self.Bind(wx.EVT_MENU, self.onTutorial, id=ID_MENU_HELP) else: self.fileMenu = wx.Menu() self.fileMenu.Append( wx.MenuItem(self.fileMenu, ID_MENU_UPDATE, "&Update")) self.fileMenu.Append(wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.doUpdate, id=ID_MENU_UPDATE) self.Bind(wx.EVT_MENU, self.onClose, id=wx.ID_EXIT) self.menuBar.Append(self.fileMenu, "&File") self.helpMenu = wx.Menu() self.helpMenu.Insert(0, wx.ID_ABOUT, "&About") self.helpMenu.Insert(1, ID_MENU_HELP, "&Help") self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT) self.Bind(wx.EVT_MENU, self.onTutorial, id=ID_MENU_HELP) self.menuBar.Append(self.helpMenu, "&Help") self.SetMenuBar(self.menuBar) inputBox = wx.StaticBox(self, label=_('Input')) inputBoxSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL) self.fileBrowse = filebrowse.FileBrowseButtonWithHistory( self, labelText=_('Excel File'), buttonText=('Browse...'), startDirectory=os.path.expanduser('~'), fileMask= 'Excel Spreadsheet (*.xlsx; *.xlsm; *.xls)|*.xlsx; *.xlsml; *.xls', size=(400, -1), history=lambda: [ self.filehistory.GetHistoryFile(i) for i in range(self.filehistory.GetCount()) ], changeCallback=self.doChangeCallback, ) inputBoxSizer.Add(self.fileBrowse, 0, flag=wx.EXPAND | wx.ALL, border=4) horizontalControlSizer = wx.BoxSizer(wx.HORIZONTAL) #------------------------------------------------------------------------------------------- verticalControlSizer = wx.BoxSizer(wx.VERTICAL) self.useUciIdCB = wx.CheckBox(self, label=_("Use UCI ID (assume no errors)")) self.useUciIdCB.SetValue(True) verticalControlSizer.Add(self.useUciIdCB, flag=wx.ALL, border=4) self.useLicenseCB = wx.CheckBox( self, label=_("Use License (assume no errors)")) self.useLicenseCB.SetValue(True) verticalControlSizer.Add(self.useLicenseCB, flag=wx.ALL, border=4) self.soundalikeCB = wx.CheckBox( self, label=_("Match misspelled names with Sound-Alike")) self.soundalikeCB.SetValue(True) verticalControlSizer.Add(self.soundalikeCB, flag=wx.ALL, border=4) self.callupSeedingRB = wx.RadioBox( self, style=wx.RA_SPECIFY_COLS, majorDimension=1, label=_("Sequence"), choices=[ _("Callups: Highest ranked FIRST (Cyclo-cross, MTB)"), _("Seeding: Highest ranked LAST (Time Trials)"), ], ) verticalControlSizer.Add(self.callupSeedingRB, flag=wx.EXPAND | wx.ALL, border=4) verticalControlSizer.Add(wx.StaticText( self, label=_('Riders with no criteria will be sequenced randomly.')), flag=wx.ALL, border=4) horizontalControlSizer.Add(verticalControlSizer, flag=wx.EXPAND) self.updateButton = RoundButton(self, size=(96, 96)) self.updateButton.SetLabel(_('Update')) self.updateButton.SetFontToFitLabel() self.updateButton.SetForegroundColour(wx.Colour(0, 100, 0)) self.updateButton.Bind(wx.EVT_BUTTON, self.doUpdate) horizontalControlSizer.Add(self.updateButton, flag=wx.ALL, border=4) horizontalControlSizer.AddSpacer(48) vs = wx.BoxSizer(wx.VERTICAL) self.tutorialButton = wx.Button(self, label=_('Help/Tutorial...')) self.tutorialButton.Bind(wx.EVT_BUTTON, self.onTutorial) vs.Add(self.tutorialButton, flag=wx.ALL, border=4) branding = wx.adv.HyperlinkCtrl( self, id=wx.ID_ANY, label=u"Powered by CrossMgr", url=u"http://www.sites.google.com/site/crossmgrsoftware/") vs.Add(branding, flag=wx.ALL, border=4) horizontalControlSizer.Add(vs) inputBoxSizer.Add(horizontalControlSizer, flag=wx.EXPAND) self.sourceList = wx.ListCtrl(self, style=wx.LC_REPORT, size=(-1, 100)) inputBoxSizer.Add(self.sourceList, flag=wx.ALL | wx.EXPAND, border=4) self.sourceList.InsertColumn(0, "Sheet") self.sourceList.InsertColumn(1, "Data Columns and Derived Information") self.sourceList.InsertColumn(2, "Key Fields") self.sourceList.InsertColumn(3, "Rows", wx.LIST_FORMAT_RIGHT) self.sourceList.InsertColumn(4, "Errors/Warnings", wx.LIST_FORMAT_RIGHT) self.sourceList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected) instructions = [ _('Drag-and-Drop the row numbers on the Left to change the sequence.' ), _('Click on Points or Position cells for details.'), _('Orange Cells: Multiple Matches. Click on the cell to see what you need to fix in the spreadsheet.' ), _('Yellow Cells: Soundalike Matches. Click on the cell to validate if the names are matched correctly.' ), ] self.grid = ReorderableGrid(self) self.grid.CreateGrid(0, 1) self.grid.SetColLabelValue(0, u'') self.grid.EnableDragRowSize(False) self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.onGridCellClick) #self.grid.Bind( wx.EVT_MOTION, self.onMouseOver ) outputBox = wx.StaticBox(self, label=_('Output')) outputBoxSizer = wx.StaticBoxSizer(outputBox, wx.VERTICAL) hs = wx.BoxSizer(wx.HORIZONTAL) self.excludeUnrankedCB = wx.CheckBox( self, label=_("Exclude riders with no ranking info")) hs.Add(self.excludeUnrankedCB, flag=wx.ALL | wx.ALIGN_CENTRE_VERTICAL, border=4) hs.AddSpacer(24) hs.Add(wx.StaticText(self, label=_("Output:")), flag=wx.ALL | wx.ALIGN_CENTRE_VERTICAL, border=4) self.topRiders = wx.Choice(self, choices=[ _('All Riders'), _('Top 5'), _('Top 10'), _('Top 15'), _('Top 20'), _('Top 25') ]) self.topRiders.SetSelection(0) hs.Add(self.topRiders, flag=wx.ALIGN_CENTRE_VERTICAL) self.saveAsExcel = wx.Button(self, label=_('Save as Excel...')) self.saveAsExcel.Bind(wx.EVT_BUTTON, self.doSaveAsExcel) hs.AddSpacer(48) hs.Add(self.saveAsExcel, flag=wx.ALL, border=4) outputBoxSizer.Add(hs) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(inputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4) for i, instruction in enumerate(instructions): flag = wx.LEFT | wx.RIGHT if i == len(instructions) - 1: flag |= wx.BOTTOM mainSizer.Add(wx.StaticText(self, label=instruction), flag=flag, border=8) mainSizer.Add(self.grid, 1, flag=wx.EXPAND | wx.ALL, border=4) mainSizer.Add(outputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4) self.SetSizer(mainSizer)
def __init__(self, parent, id, title, size=(400, 200), pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE): wx.Dialog.__init__(self, parent, wx.ID_ANY, title, size, pos, style) self.parent = parent tooltip = ("Geef hier de naam van het {} te vergelijken ini file " "of kies er een uit een lijst met recent gebruikte") title = "Selecteer het {} ini file" self.fbbh1 = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(450, -1), labelText="Vergelijk:", buttonText="Zoek", toolTip=tooltip.format('eerste'), dialogTitle=title.format("eerste"), changeCallback=self.fbbh1_callback) self.fbbh1.SetHistory(self.parent.ini.mru_left) self.fbbh1.SetValue(self.parent.lhs_path) self.fbbh2 = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(450, -1), labelText="Met: ", buttonText="Zoek", toolTip=tooltip.format('tweede'), dialogTitle=title.format('tweede'), changeCallback=self.fbbh2_callback) self.fbbh2.SetHistory(self.parent.ini.mru_right) self.fbbh2.SetValue(self.parent.rhs_path) sizer = wx.BoxSizer(wx.VERTICAL) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.fbbh1, 0, wx.ALL, 5) box.Add(self.fbbh2, 0, wx.ALL, 5) sizer.Add(box, 0, wx.ALL, 5) box = wx.BoxSizer(wx.VERTICAL) gbox = wx.FlexGridSizer(cols=2, vgap=0, hgap=4) gbox.Add(wx.StaticText(self, label='Soort vergelijking:')) self.sel = [] for ix, type_ in enumerate(sorted(shared.comparetypes)): if ix > 0: gbox.Add(wx.StaticText(self, label='')) text = shared.comparetypes[type_][0] rb = wx.RadioButton(self, label=text) gbox.Add(rb) if self.parent.comparetype == type_: rb.SetValue(True) self.sel.append((rb, type_)) box.Add(gbox, 0, wx.ALL, 9) sizer.Add(box, 0, wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "", size=(155, -1)) box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5) btn = wx.Button(self, label="&Gebruiken") self.SetAffirmativeId(btn.GetId()) box.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5) btn = wx.Button(self, 403, "&Afbreken") self.SetEscapeId(btn.GetId()) btn.SetHelpText( "Klik hier om zonder wijzigingen terug te gaan naar het hoofdscherm" ) box.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) self.SetAutoLayout(True) sizer.Fit(self)