本文整理汇总了Python中wx.lib.pubsub.Publisher.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Python Publisher.subscribe方法的具体用法?Python Publisher.subscribe怎么用?Python Publisher.subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx.lib.pubsub.Publisher
的用法示例。
在下文中一共展示了Publisher.subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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')
示例2: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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')
示例3: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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")
示例4: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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()
示例5: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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
示例6: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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")
示例7: addLoadPaths
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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)
示例8: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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)
示例9: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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')
示例10: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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
示例11: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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)
示例12: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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
示例13: __createLogger
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
def __createLogger(self, img):
logger = self.__CreationLogger(img)
Publisher.subscribe(self.receiveLogMessage,
logger._channelId)
return logger
示例14: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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")
示例15: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import subscribe [as 别名]
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()