def __init__(self, *args, **kwargs): super(SimulationToolbar, self).__init__(*args, **kwargs) # Keep default options dict as reference self.noise_level_list = ['P_1W_var_1s', 'P_2kW_var_1s' ] self.setup_options_dict = {'update_int':.5, 'fsamp':100, 'NFFT':2**12, 'noise_level':self.noise_level_list} self.default_options_dict = {'update_int':.5, 'fsamp':100, 'NFFT':2**12, 'noise_level':self.noise_level_list[1]} self.options_dict = None # Create GUI Items self.simulateButton = wx.Button(self, label='Start Simulation') self.viewsettingsButton = wx.Button(self, label='Simulation Settings') self.popupframe = SimulateSettingsFrame(self.setup_options_dict, self) self.popupframe.SetSize(self.popupframe.GetBestSize()) # Add GUI Items to Toolbar self.AddControl(self.simulateButton) self.AddControl(self.viewsettingsButton) # Bind Buttons self.viewsettingsButton.Bind(wx.EVT_BUTTON, self.on_view_button) self.simulateButton.Bind(wx.EVT_BUTTON, self.on_simulate_button) self.popupframe.closeButton.Bind(wx.EVT_BUTTON, self.on_frame_close) self.popupframe.savesettingsButton.Bind(wx.EVT_BUTTON, self.update_options_dict) # Bind Frame Close self.popupframe.Bind(wx.EVT_CLOSE, self.on_frame_close) # Subscribe to Notifications pub.subscribe(self.on_notification, 'simulation_settings')
def __init__(self, parent): HasTraits.__init__(self) # Create some data, and plot it using the embedded scene's engine self.parent = parent pub.subscribe(self.on_patient_loaded, "patient.loaded") pub.subscribe(self.voi_changed, "voi.selection_changed")
def __init__(self, model, view, xmlData): self.model = model self.view = view self.xmlData = xmlData Publisher.subscribe(self.psXmlDataChanged, "status.change.xmldatachanged") Publisher.subscribe(self.itemSelected, "config.function.selected")
def __init__(self, parent, image_fname, label=""): ToolBookTab.__init__(self, parent, image_fname, label) # List control definition self.list_ctrl = MoleculesDbListCtrl(self, style=wx.LC_REPORT|wx.BORDER_SUNKEN) self.moldb = MoleculeDb("molecules.db") self.moldb.load_all() self.list_ctrl.add_molecules(self.moldb.molecules.values()) bmp_add = wx.Image("add_btn.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap() bmp_del = wx.Image("delete_btn.ico", wx.BITMAP_TYPE_ICO).ConvertToBitmap() self.delButton = wx.BitmapButton(self, -1, bmp_del) self.addButton = wx.BitmapButton(self, -1, bmp_add) buttonSizer = wx.BoxSizer(wx.HORIZONTAL) buttonSizer.AddStretchSpacer() buttonSizer.Add(self.delButton, 0, wx.ALL|wx.ALIGN_RIGHT) buttonSizer.Add(self.addButton, 0, wx.ALL|wx.ALIGN_RIGHT) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.list_ctrl, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(buttonSizer, 0, wx.ALL|wx.EXPAND, 5) self.SetSizer(sizer) self.addButton.Bind(wx.EVT_BUTTON, self.onAddButton) self.delButton.Bind(wx.EVT_BUTTON, self.onDelButton) # Publisher pub.subscribe(self._onMoleculeAdded, 'molecule.added')
def __init__(self, *args, **kwargs): MyPanel.__init__(self, *args, **kwargs) #self.SetBackgroundColour(self.grey_col) sum_box = wx.StaticBox(self, label="Efficiency") box_sizer = wx.StaticBoxSizer(sum_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=2, cols=2) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label="Excess Capacity ", style=wx.TE_LEFT), flag=wx.EXPAND) self.eCapField = wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT) fgs.Add(self.eCapField, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label="Congestion", style=wx.TE_LEFT), flag=wx.EXPAND) self.CongField = wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT) fgs.Add(self.CongField, flag=wx.EXPAND) self.SetSizerAndFit(box_sizer) pub.subscribe(self.update, "assignments_calced")
def __init__(self, parent, id = -1): pre = wx.PrePanel() res = xmlres.loadGuiResource('ViewSelectPanel.xrc') res.LoadOnPanel(pre, parent, "ID_VIEWSELECTPANEL") self.PostCreate(pre) self._view_select = xrc.XRCCTRL(self, "ID_VIEW_SELECT") self._find_text = xrc.XRCCTRL(self, "ID_REFRESH_FIND") self._clear_filter = xrc.XRCCTRL(self, "ID_CLEAR_FIND") self._filter_text = xrc.XRCCTRL(self, "ID_TEXT_FILTER") # temp var for delayed selection of view self._the_view = -1 self._our_problem = False self._initViewSelect() self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._onViewSelected, self._view_select) self.Bind(wx.EVT_TEXT, self._onFilterText, self._filter_text) self.Bind(wx.EVT_BUTTON, self._onRefreshFilter, self._find_text) self.Bind(wx.EVT_BUTTON, self._onClearFilter, self._clear_filter) self.Bind(wx.EVT_TEXT_ENTER, self._onRefreshFilter, self._filter_text) self.Bind(wx.EVT_UPDATE_UI, self._onUpdateUI) Publisher.subscribe(self._onViewChanged, signals.SET_VIEW)
def __init__(self, parent, session, **kwargs): wx.Notebook.__init__(self, parent, **kwargs) detection_filter_panel = ResultsPanel(self, session, "detection_filter") detection_panel = ResultsPanel(self, session, "detection") extraction_filter_panel = ResultsPanel(self, session, "extraction_filter") extraction_panel = ResultsPanel(self, session, "extraction") clustering_panel = ResultsPanel(self, session, "clustering") self.AddPage(detection_filter_panel, pt.DETECTION_FILTER) self.AddPage(detection_panel, pt.DETECTION) self.AddPage(extraction_filter_panel, pt.EXTRACTION_FILTER) self.AddPage(extraction_panel, pt.EXTRACTION) self.AddPage(clustering_panel, pt.CLUSTERING) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._page_changed) self.Bind(wx.EVT_SIZE, self._on_size) # ---- Setup Subscriptions pub.subscribe(self._change_page, topic='STRATEGY_CHOICEBOOK_PAGE_CHANGED') # this is here for debugging in the pyflake shell self.results_panels = {'detection_filter':detection_filter_panel, 'detection':detection_panel, 'extraction_filter':extraction_filter_panel, 'extraction':extraction_panel, 'clustering':clustering_panel} pyshell.locals_dict['results_panels'] = self.results_panels self._selected_page_num = 0
def __init__(self, parent, id=-1): pre = wx.PrePanel() res = xmlres.loadGuiResource('ViewSelectPanel.xrc') res.LoadOnPanel(pre, parent, "ID_VIEWSELECTPANEL") self.PostCreate(pre) self._view_select = xrc.XRCCTRL(self, "ID_VIEW_SELECT") self._find_text = xrc.XRCCTRL(self, "ID_REFRESH_FIND") self._clear_filter = xrc.XRCCTRL(self, "ID_CLEAR_FIND") self._filter_text = xrc.XRCCTRL(self, "ID_TEXT_FILTER") # temp var for delayed selection of view self._the_view = -1 self._our_problem = False self._initViewSelect() self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._onViewSelected, self._view_select) self.Bind(wx.EVT_TEXT, self._onFilterText, self._filter_text) self.Bind(wx.EVT_BUTTON, self._onRefreshFilter, self._find_text) self.Bind(wx.EVT_BUTTON, self._onClearFilter, self._clear_filter) self.Bind(wx.EVT_TEXT_ENTER, self._onRefreshFilter, self._filter_text) self.Bind(wx.EVT_UPDATE_UI, self._onUpdateUI) Publisher.subscribe(self._onViewChanged, signals.SET_VIEW)
def __init__(self, model): self.model = model self.data = None self.config = model.getConfig() self.confPath = "." Publisher.subscribe(self.psXmlChanged, "status.change.xmlchanged") Publisher().subscribe(self.psConfigPathChanged, "config.path.changed")
def __init__(self, *args, **kwargs): assert "title" not in kwargs kwargs["title"] ="class-E version %s.%s.%s" % ( __version__, cc.__version__, __xl_version__) if "size" not in kwargs: kwargs["size"] = 1000, 600 wx.Frame.__init__(self, None, *args, **kwargs) self.model = cc.SESModel() #give it a picture frame mainPanel_out = wx.Panel(self) mainPanel_out.SetBackgroundColour(wx.WHITE) frame_box = wx.BoxSizer(wx.HORIZONTAL) mainPanel_in = wx.Panel(mainPanel_out) frame_box.Add( mainPanel_in, proportion=1, flag=wx.EXPAND | wx.ALL, border=20) self.topLayout(mainPanel_in) #add menubars self.addMenuBar() self.sb = self.CreateStatusBar() pub.subscribe(self.updateStatusBar, "status_bar") pub.subscribe(self.updateStatusBar, "warning") #Display everything mainPanel_out.SetSizerAndFit(frame_box) self.Show(True)
def __init__(self, win, autohide=False, enabled=True): self.Animate = True self.autohidden = False self.AutoHide = False self.docked = False self.docking = False self.LinkedWindows = [] self.manualMove = False self.motiontrigger = False self.pixelsdragged = 0 self.ShouldShowInTaskbar = lambda: True self.timer = wx.PyTimer(self.OnTimer) self.spookyGhostWindow = None self.win = win self.win.Bind(wx.EVT_ACTIVATE, self.OnActivateWin) self.win.Bind(wx.EVT_MOVE, self.OnMoving) self.lastrect = None self.SetAutoHide(autohide) self.OnDock = Delegate() self.OnHide = Delegate() publisher = Publisher() publisher.subscribe(self.OnActivateApp, 'app.activestate.changed')
def __init__(self, app): self.mainwindow = MyParentFrame() self.mainwindow.Bind(wx.EVT_MENU, self.On5MinAnalysis, id=ID_Menu_5Min) self.mainwindow.Bind(wx.EVT_MENU, self.On30MinAnalysis, id=ID_Menu_30Min) self.mainwindow.Bind(wx.EVT_MENU, self.OnDayAnalysis, id=ID_Menu_Day) self.mainwindow.Bind(wx.EVT_MENU, self.OnNewRealtimeWindow, id=ID_Menu_Realtime) self.mainwindow.Show(True) app.SetTopWindow(self.mainwindow) self.mainwindow.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.mainwindow.symbol_ctrl.Bind(wx.EVT_TEXT_ENTER, self.OnSymbolCtrlEnter) self.data_manager = DataManager() self.data_manager.start() self.symbol = "000001" self.data_manager.UpdateSymbol(self.symbol) # self.realtime_data = self.data_manager.GetQuoteData(self.symbol, 60, 1).df # self.analysis_data = self.data_manager.GetQuoteData(self.symbol, 1800, 30).df self._lastclose = self.data_manager.GetLastClose(self.symbol) self.realtime_data = None self.analysis_data = None # for d in self.data_manager.symbol_quote_dict.keys(): pub.subscribe(self.AnalysisDataArrive, "ANALYSISDATA") pub.subscribe(self.RealtimeDataArrive, "REALTIMEDATA") self.mainwindow.SetFocus() self.realtime_window = None self.analysis_window = None
def __init__(self, frame): self.frame = frame self.tb = Toolbar(self.frame, -1, wx.DefaultPosition, wx.DefaultSize, agwStyle=aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT |\ aui.AUI_TB_HORZ_TEXT) self.tb.connectButton.Bind(wx.EVT_BUTTON, self.on_connect_button) pub.subscribe(self.update_connsett, 'connsett')
def __init__(self, parent, name=None, appname="the application", filename='preferences.txt'): # Load the XRC file for our gui resources res = XmlResource(util.GetResourcePath('preferences.xrc')) self.dlgPreferences = res.LoadDialog(None, "PreferencesDialog") self.dlgPreferences.Init(name, appname) # Setup internal pubsub methods pub.subscribe(self.SetPreferenceTemplate, 'preferences.updated.template') pub.subscribe(self.SavePreferenceValues, 'preferences.updated.values') # Setup user pubsub methods pub.subscribe(self.GetPreferenceValue, 'preferences.requested.value') pub.subscribe(self.GetPreferenceValues, 'preferences.requested.values') pub.subscribe(self.SetPreferenceValue, 'preferences.updated.value') # Initialize variables self.preftemplate = [] self.values = {} self.filename = os.path.join(guiutil.get_data_dir(), filename) self.LoadPreferenceValues()
def __init__(self, app): self.nerfModel = Model() #set up the first frame which displays the current Model value self.dispView = View(None) ## thread.start_new_thread(self.nerfModel.ReadFPGA, ("Refreshing data", 0.05, 0x20)) ## self.dispView.SetMoney(self.nerfModel.myMoney) #set up the second frame which allows the user to modify the Model's value self.ctrlView = ChangerView(self.dispView) ## self.ctrlView.add.Bind(wx.EVT_BUTTON, self.AddMoney) ## self.ctrlView.remove.Bind(wx.EVT_BUTTON, self.RemoveMoney) ## self.ctrlView.slider1.Bind(wx.EVT_SLIDER, self.UpdateIa) self.ctrlView.sliderClk.Bind(wx.EVT_SLIDER, self.SendClkRate) self.ctrlView.tglReset.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset) self.xi = 0 self.old_int_x = 0.0 assert os.path.exists(MAT_FILE.encode('utf-8')), ".mat waveform file NOT found!" data = loadmat(MAT_FILE) self.x = data['x'] ## self.ctrlView.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset, self.ctrlView.tglReset) pub.subscribe(self.WantMoney, "WANT MONEY") self.dispView.Show() self.ctrlView.Show()
def __init__(self, win, autohide = False, enabled = True): self.Animate = True self.autohidden = False self.AutoHide = False self.docked = False self.docking = False self.LinkedWindows = [] self.manualMove = False self.motiontrigger = False self.pixelsdragged = 0 self.ShouldShowInTaskbar = lambda: True self.timer = wx.PyTimer(self.OnTimer) self.spookyGhostWindow = None self.win = win self.win.Bind(wx.EVT_ACTIVATE, self.OnActivateWin) self.win.Bind(wx.EVT_MOVE, self.OnMoving) self.lastrect = None self.SetAutoHide(autohide) self.OnDock = Delegate() self.OnHide = Delegate() publisher = Publisher() publisher.subscribe(self.OnActivateApp, 'app.activestate.changed')
def __init__(self, parent, editing=None): wx.Panel.__init__(self, parent) # Create the recurring object we will use internally. self.recurringObj = RecurringTransaction(None, None, 0, "", datetime.date.today(), RecurringTransaction.DAILY) self.Sizer = wx.GridBagSizer(0, 3) self.Sizer.SetEmptyCellSize((0,0)) self.Sizer.AddGrowableCol(1, 1) self.recurringRow = RecurringRow(self, self.RECURRING_ROW) self.recurringSummaryRow = RecurringSummaryRow(self, self.SUMMARY_ROW) self.weeklyRecurringRow = WeeklyRecurringRow(self, self.WEEKLY_ROW) self.transferRow = TransferRow(self, self.TRANSFER_ROW) self.transactionRow = NewTransactionRow(self, self.TRANSACTION_ROW, editing=editing) # RecurringRow needs an update once both it and the other controls exist. self.recurringRow.Update() # Hide everything up to the actual transaction row initially. if not editing: for i in range(self.TRANSACTION_ROW): self.ShowRow(i, False) ctrlId = id(self.transactionRow) Publisher.subscribe(self.onTransferToggled, "newtransaction.%i.transfertoggled"%ctrlId) Publisher.subscribe(self.onRecurringToggled, "newtransaction.%i.recurringtoggled"%ctrlId)
def addLoadPaths(self): """Adds widgets to load the data from .txt files""" #create a static boxsizer load_box = wx.StaticBox(self, label="Step 1: Input Data") box_sizer = wx.StaticBoxSizer(load_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=10, hgap=10) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) #actual data handled by a FGS self.data_btn = wx.Button(self, label="Load Data") self.data_btn.Bind(wx.EVT_BUTTON, self.onLoadData) self.assign_btn = wx.Button(self, label="Add Assignments") self.assign_btn.Bind(wx.EVT_BUTTON, self.onAddAssignment) self.assign_btn.Disable() pub.subscribe(self.dataLoaded, "data_loaded") fgs.Add(self.data_btn, proportion=1, flag = wx.EXPAND) fgs.Add(wx.StaticText(self), proportion=1, flag = wx.EXPAND) fgs.Add(self.assign_btn) btn_label = wx.StaticText(self, label="(optional)") new_font = btn_label.GetFont() new_font.SetStyle(wx.FONTSTYLE_ITALIC) btn_label.SetFont(new_font) fgs.Add(btn_label) fgs.Add(wx.StaticText(self), proportion=1, flag = wx.EXPAND) self.SetSizerAndFit(box_sizer)
def __init__(self, store, aID, name, currency=0, balance=0.0, mintId=None, currNick=False): ORMObject.__init__(self) self.IsFrozen = True self.Store = store self.ID = aID self._Name = name self._Transactions = None self._RecurringTransactions = [] self._preTransactions = [] # Make sure that Currency and Balance are not None (bug #653716) self.Currency = currency or 0 self.Balance = balance or 0.0 self.MintId = mintId self.ShowCurrencyNick = currNick or False self.IsFrozen = False Publisher.subscribe(self.onTransactionAmountChanged, "ormobject.updated.Transaction.Amount")
def __init__(self, app): self.app = app self.incident_view = IncidentView(app) #Items del Menú self.incident_view.frame.Bind(wx.EVT_MENU, self.onCreateIncident, id=xrc.XRCID('incident_mitcreate')) self.incident_view.frame.Bind(wx.EVT_MENU, self.onEditIncident, id=xrc.XRCID('incident_mitedit')) self.incident_view.frame.Bind(wx.EVT_MENU, self.onDeleteIncident, id=xrc.XRCID('incident_mitdelete')) self.incident_view.frame.Bind(wx.EVT_MENU, self.onExit, id=xrc.XRCID('incident_exit')) #ToolBar self.incident_view.frame.Bind(wx.EVT_TOOL, self.onCreateIncident, id=xrc.XRCID('incident_toolcreate')) self.incident_view.frame.Bind(wx.EVT_TOOL, self.onEditIncident, id=xrc.XRCID('incident_tooledit')) self.incident_view.frame.Bind(wx.EVT_TOOL, self.onDeleteIncident, id=xrc.XRCID('incident_tooldelete')) self.incident_view.frame.Bind(wx.EVT_TOOL, self.onRelationIncCou, id=xrc.XRCID('incident_toolinc-cou')) #Message from the Incident Model Publisher.subscribe(self.incidentModified, 'incident_deleted') Publisher.subscribe(self.incidentModified, 'IncidentHasCountermeasure_created') Publisher.subscribe(self.incidentModified, 'IncidentHasCountermeasure_deleted') Publisher.subscribe(self.incidentModified, 'incident_created') Publisher.subscribe(self.incidentModified, 'incident_updated') #Filter self.txtFilter = xrc.XRCCTRL(self.incident_view.frame, 'inc_txtfilter') self.btnFilter = xrc.XRCCTRL(self.incident_view.frame, 'inc_btnfilter') self.incident_view.frame.Bind(wx.EVT_TEXT_ENTER, self.onFilterIncident, self.txtFilter) self.incident_view.frame.Bind(wx.EVT_BUTTON, self.onFilterIncident, self.btnFilter) self.GUIincidents = [] #Cargo la lista de incident self.loadListOfIncidents_controller() self.incident_view.show()
def __init__(self, app): self.nerfModel = Model() #set up the first frame which displays the current Model value self.dispView = View(None) ## thread.start_new_thread(self.nerfModel.ReadFPGA, ("Refreshing data", 0.05, 0x20)) ## self.dispView.SetMoney(self.nerfModel.myMoney) #set up the second frame which allows the user to modify the Model's value self.ctrlView = ChangerView(self.dispView) ## self.ctrlView.add.Bind(wx.EVT_BUTTON, self.AddMoney) ## self.ctrlView.remove.Bind(wx.EVT_BUTTON, self.RemoveMoney) ## self.ctrlView.slider1.Bind(wx.EVT_SLIDER, self.UpdateIa) self.ctrlView.slider2.Bind(wx.EVT_SLIDER, self.SendMI) ## self.ctrlView.slider3.Bind(wx.EVT_SLIDER, self.UpdateLLR) ## self.ctrlView.slider4.Bind(wx.EVT_SLIDER, self.UpdatePos1) ## self.ctrlView.slider5.Bind(wx.EVT_SLIDER, self.UpdateVel1) ## self.ctrlView.slider6.Bind(wx.EVT_SLIDER, self.UpdateGamma) self.ctrlView.slider7.Bind(wx.EVT_SLIDER, self.SendClkRate) self.ctrlView.slider8.Bind(wx.EVT_SLIDER, self.SendExtTrq) pub.subscribe(self.WantMoney, "WANT MONEY") self.dispView.Show() self.ctrlView.Show()
def __init__(s, parent): wx.Panel.__init__(s, parent, style=wx.RAISED_BORDER) s.parent = parent s.devSetTree = wx.TreeCtrl(s, size=(200, -1), style=wx.TR_DEFAULT_STYLE) s.pkgTree = wx.TreeCtrl(s, size=(200, -1), style=wx.TR_DEFAULT_STYLE) s.symTree = wx.TreeCtrl(s, size=(200, -1), style=wx.TR_DEFAULT_STYLE) s.devSetTreeRoot = s.devSetTree.AddRoot('DeviceSets') s.pkgTreeRoot = s.pkgTree.AddRoot('Packages') s.symTreeRoot = s.symTree.AddRoot('Symbols') libSizer = wx.GridSizer(rows=0, cols=1, vgap=5, hgap=5) libSizer.Add(s.devSetTree, flag=wx.EXPAND) libSizer.Add(s.pkgTree, flag=wx.EXPAND) libSizer.Add(s.symTree, flag=wx.EXPAND) s.SetSizer(libSizer) libSizer.Fit(s) s.devSetTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onDevClick) s.pkgTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onPkgClick) s.symTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onSymClick) pub.subscribe(s.onLibChanged, 'libChanged') s.clearDevsetTree() s.clearPkgTree() s.clearSymTree() s.symTree.Disable() s.pkgTree.Disable() s.devSetTree.Disable() return
def __init__(self, parent, plugin_manager, **kwargs): wx.Panel.__init__(self, parent, **kwargs) self.stage_choosers = [] for stage_name in stages.stages: stage_display_name = stages.get_stage_display_name(stage_name) method_names = plugin_manager.get_plugins_by_stage( stage_name).keys() self.stage_choosers.append(StageCtrl(self, stage_name, stage_display_name, sorted(method_names))) self.stage_choosers.append(AuxiliaryCtrl(self, 'auxiliary', stages.get_stage_display_name('auxiliary'))) # issued when user chooses a stage to adjust its parameters, not when # user clicks on results tab. pub.subscribe(self.select_stage, "STAGE_CHOSEN") sizer = wx.BoxSizer(orient=wx.VERTICAL) for stage_chooser in self.stage_choosers: sizer.Add(stage_chooser, flag=wx.EXPAND) self.SetSizer(sizer) pub.subscribe(self._results_notebook_page_changed, topic='RESULTS_NOTEBOOK_PAGE_CHANGED') self._current_stage = stages.stages[0]
def __init__(self, parent, name, pnlitems=[]): """ Keyword arguments: parent : parent panel (guiWidgets.PnLTabPanel) pnlitems : pandas.DataFrame consisting of all PnL items (FrontPnL > DailyPnL.pnlitems) """ wx.Panel.__init__(self, parent, wx.ID_ANY)#-1 self.Bind(wx.EVT_SIZE, self.OnSize) self.pnlitems=pnlitems self.parent=parent self.name = name self.tree = gizmos.TreeListCtrl(self, wx.ID_ANY) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) #smileidx = il.Add(images.Smiles.GetBitmap()) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Book / item") #0 self.tree.AddColumn("Total USD P&L")#1 self.tree.AddColumn("SOD pos.") #2 self.tree.AddColumn("EOD pos.") #3 self.tree.AddColumn("P(yday)") #4 self.tree.AddColumn("P(tday)") #5 self.tree.AddColumn("SOD P&L") #6 self.tree.AddColumn("Trade P&L") #7 for i in range(1,8): self.tree.SetColumnAlignment(i,wx.ALIGN_RIGHT) self.tree.SetMainColumn(0) # self.the one wiself.th self.the tree in it... self.tree.SetColumnWidth(0, 175) self.root = self.tree.AddRoot("Total") self.treeKeyDc={} self.treeCountryDc={} self.treeIssuerDc={} self.treeBookDc={} #self.onFillTree() self.onUpdateTree() self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) if self.name == 'live': pub.subscribe(self.onRefreshTree, "REFRESH_TREE") else: pass
def __init__(self, iview): ''' Constructor ''' # ---- projectos pub().subscribe(self.add_project_in_tree, T.ADD_PROJECT_IN_TREE) pub().subscribe(self.pre_close, T.CLOSE_PROJECT) pub().subscribe(self.pre_open, T.OPEN_PROJECT) pub().subscribe(self.pre_hide, T.HIDE_PROJECT) pub().subscribe(self.pre_unhide, T.UNHIDE_PROJECT) pub.subscribe(self.pre_delete, T.DELETE_PROJECT) pub().subscribe(self.update_language, T.LANGUAGE_CHANGED) # ---- vistas pub().subscribe(self.add_view_in_tree, T.ADD_VIEW_IN_TREE) pub().subscribe(self.delete_view, T.DELETE_VIEW_TREE) # --- results pub().subscribe(self.add_results_in_tree, T.ADD_RESULTS_IN_TREE) pub().subscribe(self.delete_result, T.DELETE_RESULT_TREE) self.iview = iview self.init_tree() # ---- variables de estado self.last_sate_project = None self.less_project = False
def __init__(self, app): self.nerfModel = Model() #set up the first frame which displays the current Model value self.dispView = View(None) ## thread.start_new_thread(self.nerfModel.ReadFPGA, ("Refreshing data", 0.05, 0x20)) ## self.dispView.SetMoney(self.nerfModel.myMoney) #set up the second frame which allows the user to modify the Model's value self.ctrlView = ChangerView(self.dispView) ## self.ctrlView.add.Bind(wx.EVT_BUTTON, self.AddMoney) ## self.ctrlView.remove.Bind(wx.EVT_BUTTON, self.RemoveMoney) ## self.ctrlView.slider1.Bind(wx.EVT_SLIDER, self.UpdateIa) self.ctrlView.clkSlider.Bind(wx.EVT_SLIDER, self.OnClkRate) self.ctrlView.resetTgl.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset) self.ctrlView.gammaDynSpin.Bind( fs.EVT_FLOATSPIN, self.OnGammaDyn) ## send floating firing rate self.ctrlView.feedChoice.Bind(wx.EVT_CHOICE, self.OnFeedChoice) ## self.ctrlView.enableSimTgl.Bind(wx.EVT_TOGGLEBUTTON, self.OnEnableSim) self.ctrlView.resetSimBtn.Bind(wx.EVT_BUTTON, self.OnResetSim) ## Read the default value and send to FPGA newClkRate = self.ctrlView.clkSlider.GetValue() self.nerfModel.SendPara(newVal=newClkRate, trigEvent=DATA_EVT_CLKRATE) newGammaDyn = self.ctrlView.gammaDynSpin.GetValue() self.nerfModel.SendPara(newVal=newGammaDyn, trigEvent=DATA_EVT_GAMMA) ## self.ctrlView.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset, self.ctrlView.resetTgl) pub.subscribe(self.WantMoney, "WANT MONEY") self.dispView.Show() self.ctrlView.Show()
def __init__(s, parent): wx.Panel.__init__(s, parent, style=wx.RAISED_BORDER) s.parent = parent s.devSetTree = wx.TreeCtrl(s, size=(200,-1),style=wx.TR_DEFAULT_STYLE) s.pkgTree = wx.TreeCtrl(s, size=(200,-1),style=wx.TR_DEFAULT_STYLE) s.symTree = wx.TreeCtrl(s, size=(200,-1),style=wx.TR_DEFAULT_STYLE) s.devSetTreeRoot = s.devSetTree.AddRoot('DeviceSets') s.pkgTreeRoot = s.pkgTree.AddRoot('Packages') s.symTreeRoot = s.symTree.AddRoot('Symbols') libSizer = wx.GridSizer(rows=0,cols=1,vgap=5,hgap=5) libSizer.Add(s.devSetTree,flag=wx.EXPAND) libSizer.Add(s.pkgTree,flag=wx.EXPAND) libSizer.Add(s.symTree,flag=wx.EXPAND) s.SetSizer(libSizer) libSizer.Fit(s) s.devSetTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onDevClick) s.pkgTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onPkgClick) s.symTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, s.onSymClick) pub.subscribe(s.onLibChanged, 'libChanged') s.clearDevsetTree() s.clearPkgTree() s.clearSymTree() s.symTree.Disable() s.pkgTree.Disable() s.devSetTree.Disable() return
def __init__(self, app): self.mainwindow = MyParentFrame() self.mainwindow.Bind(wx.EVT_MENU, self.On5MinAnalysis, id=ID_Menu_5Min) self.mainwindow.Bind(wx.EVT_MENU, self.On30MinAnalysis, id=ID_Menu_30Min) self.mainwindow.Bind(wx.EVT_MENU, self.OnDayAnalysis, id=ID_Menu_Day) self.mainwindow.Bind(wx.EVT_MENU, self.OnNewRealtimeWindow, id=ID_Menu_Realtime) self.mainwindow.Show(True) app.SetTopWindow(self.mainwindow) self.mainwindow.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.mainwindow.symbol_ctrl.Bind(wx.EVT_TEXT_ENTER, self.OnSymbolCtrlEnter) self.data_manager = DataManager() self.data_manager.start() self.symbol = '000001' self.data_manager.UpdateSymbol(self.symbol) #self.realtime_data = self.data_manager.GetQuoteData(self.symbol, 60, 1).df #self.analysis_data = self.data_manager.GetQuoteData(self.symbol, 1800, 30).df self._lastclose = self.data_manager.GetLastClose(self.symbol) self.realtime_data = None self.analysis_data = None #for d in self.data_manager.symbol_quote_dict.keys(): pub.subscribe(self.AnalysisDataArrive, "ANALYSISDATA") pub.subscribe(self.RealtimeDataArrive, "REALTIMEDATA") self.mainwindow.SetFocus() self.realtime_window = None self.analysis_window = None
def __init__(self, parent): self.parent = parent # Set up pubsub pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data') pub.subscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
def __init__(self, parent=None): """ Initialization. Parameters: parent - parent window (wx.Window) """ self.is_loop = False self.is_display = False self.is_save = False self.is_axis = False self.is_input = False self.is_root = False self.is_active = True self.is_visible = True self.can_run = True self.host = parent self.name = self.__extname__ self.itmList = [] self.propNodes = [] self.propNames = [] self.m_id = 0 # self.propFont = wx.Font(8,wx.DECORATIVE,wx.NORMAL,wx.NORMAL) # self.propColour = "#3F3F3F" self.config = [] # variables to be saved in config files pub.subscribe(self.stop, "scan.stop")
def __init__(self, *args, **kwargs): assert "title" not in kwargs kwargs["title"] = "class-E version %s.%s.%s" % ( __version__, cc.__version__, __xl_version__) if "size" not in kwargs: kwargs["size"] = 1000, 600 wx.Frame.__init__(self, None, *args, **kwargs) self.model = cc.SESModel() #give it a picture frame mainPanel_out = wx.Panel(self) mainPanel_out.SetBackgroundColour(wx.WHITE) frame_box = wx.BoxSizer(wx.HORIZONTAL) mainPanel_in = wx.Panel(mainPanel_out) frame_box.Add(mainPanel_in, proportion=1, flag=wx.EXPAND | wx.ALL, border=20) self.topLayout(mainPanel_in) #add menubars self.addMenuBar() self.sb = self.CreateStatusBar() pub.subscribe(self.updateStatusBar, "status_bar") pub.subscribe(self.updateStatusBar, "warning") #Display everything mainPanel_out.SetSizerAndFit(frame_box) self.Show(True)
def __init__(self, *args, **kwargs): MyPanel.__init__(self, *args, **kwargs) sum_box = wx.StaticBox(self, label="Fairness") box_sizer = wx.StaticBoxSizer(sum_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=2, cols=4, hgap = 10) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, style=wx.ALIGN_RIGHT), flag = wx.EXPAND) fgs.Add(wx.StaticText(self, label="Dept", style=wx.ALIGN_RIGHT), flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label="Room", style=wx.ALIGN_RIGHT), flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label="Time", style=wx.ALIGN_RIGHT), flag=wx.EXPAND) self.minDeptFields = [wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_RIGHT), wx.StaticText(self, style=wx.ALIGN_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_RIGHT)] fgs.Add(wx.StaticText(self, label="Min", style=wx.ALIGN_RIGHT), flag = wx.EXPAND) for field in self.minDeptFields: fgs.Add(field, flag=wx.EXPAND) self.maxDeptFields = [wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_RIGHT), wx.StaticText(self, style=wx.ALIGN_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_RIGHT)] fgs.Add(wx.StaticText(self, label="Max", style=wx.ALIGN_RIGHT), flag = wx.EXPAND) for field in self.maxDeptFields: fgs.Add(field, flag=wx.EXPAND) self.SetSizerAndFit(box_sizer) self.sizer = box_sizer pub.subscribe(self.update, "assignments_calced")
def addLoadPaths(self): """Adds widgets to load the data from .txt files""" #create a static boxsizer load_box = wx.StaticBox(self, label="Step 1: Input Data") box_sizer = wx.StaticBoxSizer(load_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=10, hgap=10) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) #actual data handled by a FGS self.data_btn = wx.Button(self, label="Load Data") self.data_btn.Bind(wx.EVT_BUTTON, self.onLoadData) self.assign_btn = wx.Button(self, label="Add Assignments") self.assign_btn.Bind(wx.EVT_BUTTON, self.onAddAssignment) self.assign_btn.Disable() pub.subscribe(self.dataLoaded, "data_loaded") fgs.Add(self.data_btn, proportion=1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self), proportion=1, flag=wx.EXPAND) fgs.Add(self.assign_btn) btn_label = wx.StaticText(self, label="(optional)") new_font = btn_label.GetFont() new_font.SetStyle(wx.FONTSTYLE_ITALIC) btn_label.SetFont(new_font) fgs.Add(btn_label) fgs.Add(wx.StaticText(self), proportion=1, flag=wx.EXPAND) self.SetSizerAndFit(box_sizer)
def __init__(self, dao, parent=None, id=-1, title='D2C'): wx.Frame.__init__(self, parent, id, title, size=(750, 550)) self.Center() self.__initMenuBar() toolbar = self.CreateToolBar() toolbar.AddLabelTool(self.ID_CONF, '', wx.Bitmap(pkg_resources.resource_filename(__package__, "icons/keys-icon.png"))) toolbar.AddLabelTool(self.ID_CLOUD, '', wx.Bitmap(pkg_resources.resource_filename(__package__, "icons/cloud-hd-icon.png"))) toolbar.AddLabelTool(self.ID_ADD_DEPLOYMENT, '', wx.Bitmap(pkg_resources.resource_filename(__package__, "icons/network-icon.png"))) self.tabContainer = wx.Notebook(self, -1, style=wx.NB_TOP) self.imageTab = ImageTab(dao, self.tabContainer, -1) self.tabContainer.AddPage(self.imageTab, "Images") self.imagePanel = RawImagePanel(self.tabContainer, -1) #self.tabContainer.AddPage(self.imagePanel, "Source Images") self.amiPanel = AMIPanel(self.tabContainer, -1) self.tabContainer.AddPage(self.amiPanel, "AMIs") self.deploymentPanel = DeploymentTab(dao, self.tabContainer, -1) self.tabContainer.AddPage(self.deploymentPanel, "Deployment Templates/Deployments") #TODO move to controller pub.subscribe(self.__createAMI, "CREATE AMI")
def __init__(self, *args, **kwargs): MyPanel.__init__(self, *args, **kwargs) sum_box = wx.StaticBox(self, label="Preferences") box_sizer = wx.StaticBoxSizer(sum_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=3, cols=5) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) fgs.AddMany([(wx.StaticText(self, style=wx.ALIGN_LEFT), 0, wx.EXPAND), (wx.StaticText(self, label="1st", style=wx.ALIGN_LEFT), 0, wx.EXPAND), (wx.StaticText(self, label="2nd", style=wx.ALIGN_LEFT), 0, wx.EXPAND), (wx.StaticText(self, label="3rd", style=wx.ALIGN_LEFT), 0, wx.EXPAND), (wx.StaticText(self, label="Other", style=wx.ALIGN_LEFT), 0, wx.EXPAND) ]) self.RoomPrefFields = [wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT)] fgs.Add(wx.StaticText(self, label="Rooms ", style=wx.TE_LEFT), flag = wx.EXPAND) for field in self.RoomPrefFields: fgs.Add(field, flag=wx.EXPAND) self.TimePrefFields = [wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT), wx.StaticText(self, size=self.sz_num_field, style=wx.ALIGN_LEFT)] fgs.Add(wx.StaticText(self, label="Times ", style=wx.TE_LEFT), flag = wx.EXPAND) for field in self.TimePrefFields: fgs.Add(field, flag=wx.EXPAND) self.SetSizerAndFit(box_sizer) pub.subscribe(self.updatePrefs, "assignments_calced")
def __init__(self, app): self.nerfModel = Model() #set up the first frame which displays the current Model value self.dispView = View(None) ## thread.start_new_thread(self.nerfModel.ReadFPGA, ("Refreshing data", 0.05, 0x20)) ## self.dispView.SetMoney(self.nerfModel.myMoney) #set up the second frame which allows the user to modify the Model's value self.ctrlView = ChangerView(self.dispView) ## self.ctrlView.add.Bind(wx.EVT_BUTTON, self.AddMoney) ## self.ctrlView.remove.Bind(wx.EVT_BUTTON, self.RemoveMoney) ## self.ctrlView.slider1.Bind(wx.EVT_SLIDER, self.UpdateIa) self.ctrlView.clkSlider.Bind(wx.EVT_SLIDER, self.OnClkRate) self.ctrlView.resetTgl.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset) self.ctrlView.gammaDynSpin.Bind(fs.EVT_FLOATSPIN, self.OnGammaDyn) ## send floating firing rate self.ctrlView.feedChoice.Bind(wx.EVT_CHOICE, self.OnFeedChoice) ## self.ctrlView.enableSimTgl.Bind(wx.EVT_TOGGLEBUTTON, self.OnEnableSim) self.ctrlView.resetSimBtn.Bind(wx.EVT_BUTTON, self.OnResetSim) ## Read the default value and send to FPGA newClkRate = self.ctrlView.clkSlider.GetValue() self.nerfModel.SendPara(newVal = newClkRate, trigEvent = DATA_EVT_CLKRATE) newGammaDyn = self.ctrlView.gammaDynSpin.GetValue() self.nerfModel.SendPara(newVal = newGammaDyn, trigEvent = DATA_EVT_GAMMA) ## self.ctrlView.Bind(wx.EVT_TOGGLEBUTTON, self.OnReset, self.ctrlView.resetTgl) pub.subscribe(self.WantMoney, "WANT MONEY") self.dispView.Show() self.ctrlView.Show()
def __createLogger(self, img): logger = self.__CreationLogger(img) Publisher.subscribe(self.receiveLogMessage, logger._channelId) return logger
def __init__(self, datachannel, parent, size, pos, sampleRate=1, timeRange=(0,120), currentRange=(0,50), camera=None): super(PlotDisplay,self).__init__(parent, size=size, pos=pos) self.datachannel = datachannel (self.dimx,self.dimy) = self.GetSize() print pos channel = "average_power" pub.subscribe(self.newData, channel) self.imageScale = .95 (self.dimx,self.dimy) = self.GetSize() self.imgx = self.dimx*self.imageScale self.imgy = self.dimx*self.imageScale*.75 self.timeRange = timeRange self.currentRange = currentRange self.sampleRate = sampleRate self.nPoints = (timeRange[1] - timeRange[0])*sampleRate+1 self.xStep = sampleRate/float(timeRange[1] - timeRange[0]) self.xData = np.linspace(timeRange[0], timeRange[1], self.nPoints).tolist() self.yData = np.zeros(self.nPoints).tolist() self.camera = camera #print self.xData self.SetBackgroundColour("white") self.newPoints = 0
def __init__(self, parent): self.parent = parent self.images = [] self.old_imagenum = 0 pub.subscribe(self.OnUpdatePatient, 'patient.updated.parsed_data') pub.subscribe(self.OnUpdateImage, '2dview.updated.image')
def __init__(self, parent, id, title, aDEVS, separator=" "): """ Constructor """ wx.Frame.__init__(self, parent, wx.ID_ANY, aDEVS.getBlockModel().label, size = (550, 500), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE|wx.STAY_ON_TOP) self.model = aDEVS self.sep = separator ### toolbar setting toolbar = wx.ToolBar(self, wx.ID_ANY, style= wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT | wx.TB_TEXT) toolbar.SetToolBitmapSize((25,25)) # juste for windows new = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'new.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'New', '') open_file = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'open.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Open', '') saveas = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'save.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'SaveAs', '') toolbar.AddSeparator() cut = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'cut.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Cut', '') copy = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'copy.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Copy', '') paste = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'paste.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Paste', '') self.delete = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'delete.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Delete', '') toolbar.AddSeparator() update = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'reload.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Update', '') toolbar.AddSeparator() self.chart = toolbar.AddSimpleTool(wx.NewId(), wx.Image(os.path.join(ICON_PATH,'graph_guru.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'Chart', '') toolbar.EnableTool(self.chart.GetId(), False) toolbar.Realize() self.SetToolBar(toolbar) self.statusbar = self.CreateStatusBar() ### notebook setting self.notebook = wx.Notebook(self, wx.ID_ANY) ### Load data form devs model self.LoadingDataInPage() ### Layout box = wx.BoxSizer(wx.VERTICAL) box.Add(self.notebook, 1, wx.EXPAND) self.SetSizer(box) ### binding self.Bind(wx.EVT_TOOL, self.OnNew, new) self.Bind(wx.EVT_TOOL, self.OnOpen, open_file) self.Bind(wx.EVT_TOOL, self.OnSaveAs, saveas) self.Bind(wx.EVT_TOOL, self.OnCopy, copy) self.Bind(wx.EVT_TOOL, self.OnCut, cut) self.Bind(wx.EVT_TOOL, self.OnPaste, paste) self.Bind(wx.EVT_TOOL, self.OnDelete, self.delete) self.Bind(wx.EVT_TOOL, self.OnUpdate, update) self.Bind(wx.EVT_TOOL, self.OnGraph, self.chart) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnTab, self.notebook) ### pubsub ### when is sheet is full, graph icon is enabled Publisher.subscribe(self.EnableGraphIcon, ("isfull")) Publisher.subscribe(self.OnProgress, ("progress"))
class IModel(object): __metaclass__ = abc.ABCMeta logger = logging.getLogger("genicontrol") def __init__(self): #super(IModel, self).__init__(self) self._pub = Publisher() #self.initialize() def sendMessage(self, topic, data): self._pub.sendMessage(topic, data) def subscribe(self, topic, callback): self._pub.subscribe(topic = topic, listener = callback) @abc.abstractmethod def initialize(self): pass ## todo: getListOf MeasurementValues, etc. @abc.abstractmethod def connect(self, *parameters): pass @abc.abstractmethod def disconnect(self): pass @abc.abstractmethod def requestMeasurementValues(self): pass @abc.abstractmethod def requestParameters(self): pass @abc.abstractmethod def requestReferences(self): pass @abc.abstractmethod def requestInfo(self): pass @abc.abstractmethod def setReferenceValue(self, item, value): pass @abc.abstractmethod def setParameterValue(self, item, value): pass @abc.abstractmethod def sendCommand(self, command): pass def dissectResponse(self, resp): pass
def register (method, event): """ A wrapper around the publisher method. @param method: the listening method @param event: the listening message """ Publisher.subscribe (method, event)
def __init__(self, parent, id, title): style = (wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN) wx.Frame.__init__(self, parent, id, title, size = (910,655), style=style) Publisher.subscribe(self.update_percent, "update percentage") Publisher.subscribe(self.update_status , "update status") self.init_gui() self.dir=None
def _setup_subscriptions(self): pub.subscribe(self._set_run_buttons_state, topic='SET_RUN_BUTTONS_STATE' ) pub.subscribe(self._method_chosen, topic='METHOD_CHOSEN') pub.subscribe(self._stage_chosen, topic='STAGE_CHOSEN') pub.subscribe(self._strategy_added, topic='STRATEGY_ADDED') pub.subscribe(self._current_strategy_updated, topic='CURRENT_STRATEGY_UPDATED')
def __init__(self, parent): wx.ProgressDialog.__init__(self, "Setup Molecule", "Loading molecule...", maximum=100, parent=parent, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE) pub.subscribe(self._onUpdate, 'setupdialog.update')
def __init__(self, parent): self.parent = parent # Set up pubsub pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data') # Load the XRC file for our gui resources self.res = XmlResource(util.GetBasePluginsPath('anonymize.xrc'))
def __init__(self, parent): wx.Panel.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.topPanel = ButtonPanel(self) self.bottomPanel = CanvasPanel(self, None) self.sizer.Add(self.topPanel, 0, wx.ALL | wx.EXPAND) self.sizer.Add(self.bottomPanel, 1, wx.ALL | wx.EXPAND) self.SetSizer(self.sizer) pub.subscribe(self.reDraw, "CHART_READY")
def __init__(self, parent, fpaths, options, *args, **kwargs): wx.Dialog.__init__(self, parent, title="ND-SAFIR running", *args, **kwargs) self.fpaths = fpaths self.options = options self.skip_flag = threading.Event() self.abort_flag = threading.Event() sizer = wx.BoxSizer(wx.VERTICAL) ## We use the double of the number of files as range for the progress ## dialog. This is because it only accepts integers and we want to ## set the progress to the value between the file number, e.g., we ## want to set the value to 0.5, when processing the first file. self.gauge = wx.Gauge(self, range=len(self.fpaths) * 2) sizer.Add(self.gauge, flag=wx.TOP | wx.EXPAND | wx.LEFT | wx.RIGHT, border=16) self.msg = wx.StaticText(self) sizer.Add(self.msg, flag=wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL) cpane = wx.CollapsiblePane(self, label="Details") sizer.Add(cpane, proportion=1, flag=wx.GROW | wx.ALL) pane = cpane.GetPane() pane_sizer = wx.BoxSizer(wx.VERTICAL) self.output = wx.TextCtrl(pane, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) pane_sizer.Add(self.output, proportion=1, flag=wx.GROW | wx.ALL, border=16) pane.SetSizer(pane_sizer) self.btns = wx.BoxSizer(wx.HORIZONTAL) skip_btn = wx.Button(self, label="Skip") skip_btn.Bind(wx.EVT_BUTTON, self.on_skip_EVT_BUTTON) self.btns.Add(skip_btn) abort_btn = wx.Button(self, label="Abort") abort_btn.Bind(wx.EVT_BUTTON, self.on_abort_EVT_BUTTON) self.btns.Add(abort_btn) sizer.Add(self.btns, flag=wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) ## Events coming from the ndsafir master thread self.Bind(EVT_NDSAFIR_START, self.on_EVT_NDSAFIR_START) self.Bind(EVT_NDSAFIR_END, self.on_EVT_NDSAFIR_END) self.Bind(EVT_NDSAFIR_ALL_DONE, self.on_EVT_NDSAFIR_ALL_DONE) ## Coming from the work threads via pubsub Publisher.subscribe(self.on_NDSAFIR_OUTPUT, 'NDSAFIR_OUTPUT') self.SetSizerAndFit(sizer)
def __init__(self, *args, **kwargs): MyPanel.__init__(self, *args, **kwargs) sum_box = wx.StaticBox(self, label="Course Breakdown") box_sizer = wx.StaticBoxSizer(sum_box, wx.VERTICAL) fgs = wx.FlexGridSizer(rows=3, cols=3) box_sizer.Add(fgs, proportion=1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label="All"), flag=wx.TE_LEFT) self.TotalCourses = (wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT)) fgs.AddMany(self.TotalCourses) fgs.Add(wx.StaticText(self, label="Lectures"), flag=wx.TE_LEFT) self.NoLecturesFields = (wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT)) fgs.Add(self.NoLecturesFields[0], flag=wx.TE_RIGHT) fgs.Add(self.NoLecturesFields[1], flag=wx.TE_RIGHT) fgs.Add(wx.StaticText(self, label="Other"), flag=wx.TE_LEFT) self.NoOtherCourses = (wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT)) fgs.AddMany(self.NoOtherCourses) fgs.Add(wx.StaticText(self, label="Fixed Rooms "), flag=wx.TE_LEFT) self.FixedRooms = (wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT)) fgs.AddMany(self.FixedRooms) fgs.Add(wx.StaticText(self, label="Fixed Times"), flag=wx.TE_LEFT) self.FixedTimes = (wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT), wx.StaticText(self, size=self.sz_num_field, style=wx.TE_RIGHT)) fgs.AddMany(self.FixedTimes) self.SetSizerAndFit(box_sizer) pub.subscribe(self.updateCourseRequests, "data_loaded")
def __init__(self, *args, **kwargs): super(ObserverFrame, self).__init__(*args, **kwargs) # Attributes self.txt = wx.TextCtrl(self, style=wx.TE_MULTILINE) self.txt.SetValue("Change the font in the config " "dialog and see it update here.") # Observer of configuration changes Publisher.subscribe(self.OnConfigMsg, MSG_CONFIG_ROOT)
def __init__(self, parent): self.parent = parent # Set up pubsub pub.subscribe(self.OnUpdateImage, '2dview.updated.image') pub.subscribe(self.OnMouseDown, '2dview.mousedown') # Plugin is not ready to measure until the menu has been launched self.start_measuring = False
def __init__(self, parent): self.parent = parent # Set up pubsub pub.subscribe(self.OnUpdatePatient, 'patient.updated.parsed_data') # Load the XRC file for our gui resources xrc = os.path.join(os.path.dirname(__file__), 'Analysis.xrc') self.res = XmlResource(xrc)
def __init__( self, *args, **kwargs ): wx.Panel.__init__( self, *args, **kwargs ) self._comps = {} self.app = wx.GetApp() self.filter = pm.PandaNode # Build display filter menu. fileMenu = fm.FlatMenu() item = fm.FlatMenuItem( fileMenu, DISPLAY_NODEPATHS, '&NodePaths Only', '', wx.ITEM_CHECK ) item.Check() fileMenu.AppendItem( item ) self.fm = fm.FlatMenuBar( self, -1, 16, 1, options=fmr.FM_OPT_IS_LCD ) self.fm.Append( fileMenu, '&Display' ) self.fm.GetRendererManager().SetTheme( fm.StyleVista ) ln = wx.StaticLine( self, -1, style=wx.LI_HORIZONTAL ) # Bind menu controls self.Bind( fm.EVT_FLAT_MENU_SELECTED, self.OnFlatMenuSelected, id=DISPLAY_NODEPATHS ) # Build tree control self.tc = CustomTreeCtrl( self, -1, agwStyle= ct.TR_EDIT_LABELS | ct.TR_HIDE_ROOT | ct.TR_FULL_ROW_HIGHLIGHT | ct.TR_NO_LINES | ct.TR_HAS_BUTTONS | ct.TR_TWIST_BUTTONS | ct.TR_MULTIPLE ) self.tc.AddRoot( 'root' ) # Bind tree control events self.tc.Bind( wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTreeBeginLabelEdit ) self.tc.Bind( wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit ) self.tc.Bind( wx.EVT_LEFT_DCLICK, self.OnLeftDClick ) self.tc.Bind( wx.EVT_KEY_UP, p3d.wx.OnKeyUp ) self.tc.Bind( wx.EVT_KEY_DOWN, p3d.wx.OnKeyDown ) self.tc.Bind( wx.EVT_LEFT_UP, p3d.wx.OnLeftUp ) self.tc.Bind( wx.EVT_MIDDLE_DOWN, self.OnMiddleDown ) # Build tree control drop target self.dt = CustomDropTarget( ['filePath', 'nodePath'], self ) self.tc.SetDropTarget( self.dt ) # Bind publisher events pub.subscribe( self.OnUpdate, 'Update' ) # Build sizers self.bs1 = wx.BoxSizer( wx.VERTICAL ) self.bs1.Add( self.fm, 0, wx.EXPAND ) self.bs1.Add( ln, 0, wx.EXPAND ) self.bs1.Add( self.tc, 1, wx.EXPAND ) self.SetSizer( self.bs1 )
def __init__(self, parent, id): ''' Initialisation for the main frame. Arguments parent: The parent window of the frame. id: The ID to give the frame. ''' self.displayCache = None size = geocacher.config().mainWinSize # check that the Current location is in the db if geocacher.config().currentLocation not in geocacher.db( ).getLocationNameList(): geocacher.config().currentLocation = geocacher.db( ).getLocationNameList()[0] wx.Frame.__init__(self, parent, wx.ID_ANY, _("Geocacher"), size=(size), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) self.Bind(wx.EVT_CLOSE, self.OnQuit) self.SetIcon( wx.Icon( os.path.join(geocacher.getBasePath(), 'gfx', 'treasure_chest.ico'), wx.BITMAP_TYPE_ICO)) self.buildStatusBar() self.buildMenu() self.buildToolBar() self.splitter = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_LIVE_UPDATE | wx.SP_BORDER) self.cacheGrid = CacheGrid(self.splitter) self.Description = Html.HtmlWindow(self.splitter, wx.ID_ANY, name="Description Pannel") self.splitter.SetMinimumPaneSize(20) self.splitter.SplitHorizontally(self.cacheGrid, self.Description, geocacher.config().detailSplit) self.updateStatus() self.displayedCache = None self.updateDetail(geocacher.config().displayedCache) Publisher.subscribe(self.updateDetailMsg, 'cache.selected') Publisher.subscribe(self.NewLocationMsg, 'location.new') Publisher.subscribe(self.popStatusMsg, 'status.pop') Publisher.subscribe(self.pushStatusMsg, 'status.push') Publisher.subscribe(self.updateStatusMsg, 'status.update')
def __init__(self, app): self.app = app self.equipment_view = EquipmentView(app) #Menu Items self.equipment_view.frame.Bind(wx.EVT_MENU, self.onCreateEquipment, id=xrc.XRCID('equipment_mitcreate')) self.equipment_view.frame.Bind(wx.EVT_MENU, self.onEditEquipment, id=xrc.XRCID('equipment_mitedit')) self.equipment_view.frame.Bind(wx.EVT_MENU, self.onDeleteEquipment, id=xrc.XRCID('equipment_mitdelete')) self.equipment_view.frame.Bind(wx.EVT_MENU, self.onExit, id=xrc.XRCID('equipment_exit')) #ToolBar self.equipment_view.frame.Bind(wx.EVT_TOOL, self.onCreateEquipment, id=xrc.XRCID('equipment_toolcreate')) self.equipment_view.frame.Bind(wx.EVT_TOOL, self.onEditEquipment, id=xrc.XRCID('equipment_tooledit')) self.equipment_view.frame.Bind(wx.EVT_TOOL, self.onDeleteEquipment, id=xrc.XRCID('equipment_tooldelete')) self.equipment_view.frame.Bind(wx.EVT_TOOL, self.onRelationEquCou, id=xrc.XRCID('equipment_toolequ-cou')) #Message from the Equipment Model Publisher.subscribe(self.equipmentModified, 'equipment_deleted') Publisher.subscribe(self.equipmentModified, 'equipment_created') Publisher.subscribe(self.equipmentModified, 'equipment_updated') #Publisher.subscribe(self.equipmentModified, 'countermeasure_updated') Publisher.subscribe(self.equipmentModified, 'equipment_created') Publisher.subscribe(self.equipmentModified, 'equipment_updated') #Filter self.txtFilter = xrc.XRCCTRL(self.equipment_view.frame, 'equ_txtfilter') self.btnFilter = xrc.XRCCTRL(self.equipment_view.frame, 'equ_btnfilter') self.equipment_view.frame.Bind(wx.EVT_TEXT_ENTER, self.onFilterEquipment, self.txtFilter) self.equipment_view.frame.Bind(wx.EVT_BUTTON, self.onFilterEquipment, self.btnFilter) self.GUIequipments = [] #Load equipment list self.loadListOfEquipments_controller() self.equipment_view.show()
def __init__(self, *args, **kwargs): MyPanel.__init__(self, *args, **kwargs) #Create a Sizer and place a single display in it vbox = wx.BoxSizer(wx.VERTICAL) self.TextLog = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY) vbox.Add(self.TextLog, proportion=1, flag=wx.EXPAND) self.SetSizerAndFit(vbox) pub.subscribe(self.logErrors, "warning") pub.subscribe(self.logErrors, "status_bar")
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) self.app = wx.GetApp() # Bind project file events pub.subscribe(self.OnUpdate, 'projectFilesAdded') pub.subscribe(self.OnUpdate, 'projectFilesRemoved') # Build sizers self.bs1 = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.bs1)