本文整理汇总了Python中wx.lib.pubsub.Publisher.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Python Publisher.sendMessage方法的具体用法?Python Publisher.sendMessage怎么用?Python Publisher.sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx.lib.pubsub.Publisher
的用法示例。
在下文中一共展示了Publisher.sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: zoomCtrlOnChanged
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def zoomCtrlOnChanged(self, evt):
match = re.match('\s*([+-]?\d+)\s*$', evt.String)
if match:
pub.sendMessage("CHANGE_ZOOM", int(match.group(1)))
else:
# This should eventually restore previous value
pub.sendMessage("CHANGE_ZOOM", -1)
示例2: LoadMarkets
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def LoadMarkets(self):
self.markets = self.session.GetAvailableMarkets()
if self.markets == None:
return False
self.treeMarkets.DeleteAllItems()
root = self.treeMarkets.AddRoot('Markets')
# Add all markets to the tree
items = {}
for market in self.markets:
path = ''
parent = root
# Iterate over the market path
for item in market.menuPathParts:
path = path + item
if path in items:
parent = items[path]
continue
# Add this node if it doesn't exist
parent = items[path] = self.treeMarkets.AppendItem(parent, item)
# After all of the parent nodes are present, at the market type
items[path + market.marketName] = self.treeMarkets.AppendItem(items[path], market.marketName)
# Attach the market information to the tree object for extraction later
self.treeMarkets.SetPyData(items[path + market.marketName], market)
self.treeMarkets.Expand(root)
pub.sendMessage(SUBJECT_STATUSBAR,
'Found ' + str(len(self.markets)) + ' available ' + self.session.sessionType + ' markets')
return True
示例3: SetPlotColors
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def SetPlotColors(self):
"""
Set canvas plot colors.
"""
# get number of arrays with custom color
Nc = 0
for x in self.plots:
x.color = None
if x.array!=None:
if x.array.color!=None:
x.color = x.array.color
Nc+=1
Np = len(self.plots)-Nc
np = Np-1
for x in self.plots:
if x.color != None:
color = x.color
else:
color = (1.0-(np+1.0)/(Np*1.0),0.0,(np+1.0)/(Np*1.0))
np -= 1
if x.source==None:
x.SetColor(color)
y = x.children
while len(y)>0:
for z in y:
z.SetColor(color)
y = y[-1].children
# send color change event to notify history from change
pub.sendMessage("plot.color_change")
示例4: __init__
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def __init__(self, ip, portFrom, portTo):
Thread.__init__(self)
self.IP = ip
self.portFrom = portFrom
self.portTo = portTo
Publisher.sendMessage("scanThread", "started")
self.start()
示例5: save
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def save(self):
fout = open("library.db",'wb')
pickle.dump(self.books,fout)
fout.close()
print "Saved", len(self.books), "books"
pub.sendMessage("SAVED",len(self.books))
示例6: _trial_added
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def _trial_added(self, message):
trial = message.data
trial_name = trial.display_name
new_row = self._num_nonempty_rows
self._trial_ids.append(trial.trial_id)
self._trials[trial.trial_id] = trial
self._set_trial_name(new_row, trial_name)
self._autosize_cols()
if self._num_empty_rows > 1:
self._num_empty_rows -= 1
else:
self.AppendRows()
assert len(self._trial_ids) == self._num_nonempty_rows
# make new trial come in correctly marked.
row = self._get_row_from_trial_id(trial.trial_id)
self.SetCellRenderer(row, 0, gridlib.GridCellBoolRenderer())
self._set_marked_status(row, trial.is_marked)
# only select new trial if nothing is selected.
if self._last_trial_id_selected is None:
self._last_trial_id_selected = 'Not-None'
wx.CallLater(1000, self._select_row, row)
pub.sendMessage('SET_RUN_BUTTONS_STATE', data=[True, True])
示例7: saveSettings
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def saveSettings(self):
"""
Save settings
"""
db = WpDatabaseAPI()
## Saving tab size
self.configobj.settings['editor-tabsize'] = self.tabsizeinput.GetValue()
db.AddRegisterSetting('tabsize', self.configobj.settings['editor-tabsize'], 'editor')
# Saving if tab is to be used
self.configobj.settings['editor-usetab'] = 1 if self.checkbox.IsChecked() == True else 0
db.AddRegisterSetting('usetab', self.configobj.settings['editor-usetab'], 'editor')
## Saving margin settings
self.configobj.settings['editor-textmargin'] = self.marginSizeInput.GetValue()
db.AddRegisterSetting( 'textmargin', self.configobj.settings['editor-textmargin'], 'editor' )
## Saving code folding
self.configobj.settings['editor-foldcode'] = 1 if self.codeFoldCheckbox.IsChecked() == True else 0
db.AddRegisterSetting('foldcode', self.configobj.settings['editor-foldcode'], 'editor')
## Saving code folding style
self.configobj.settings['editor-foldcodestyle'] = self.foldCodeStyleSelect.GetCurrentSelection()
db.AddRegisterSetting('foldcodestyle', self.configobj.settings['editor-foldcodestyle'], 'editor')
## Saving fonts
self.configobj.settings['editor-fontface'] = self.fontListCtrl.GetStringSelection()
self.configobj.settings['editor-fontsize'] = int( self.fontSizeSelect.GetString( self.fontSizeSelect.GetSelection() ) )
db.AddRegisterSetting( 'fontface', self.configobj.settings['editor-fontface'], 'editor' )
db.AddRegisterSetting( 'fontsize', self.configobj.settings['editor-fontsize'], 'editor' )
## Notify the editor to refrsh
pub.sendMessage('editor.refresh', True)
示例8: OnMouseWheel
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnMouseWheel(self, evt):
"""Capture the mousewheel event when the notebook tab is focused.
Currently this is used to workaround a bug in Windows since the
notebook tab instead of the panel receives focus."""
if guiutil.IsMSWindows():
pub.sendMessage('main.mousewheel', evt)
示例9: OnModified
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnModified( self, comps=None ):
"""
Broadcast the update message and set the dirty flag. Methods
subscribed to this message will rebuild ui widgets completely.
"""
self.dirty = True
pub.sendMessage( 'Update', comps )
示例10: OnIsodoseCheck
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnIsodoseCheck(self, msg):
"""Load the properties of the currently checked isodoses."""
isodose = msg.data
self.isodoseList[isodose['data']['level']] = isodose
pub.sendMessage('isodoses.checked', self.isodoseList)
示例11: OnKeyDown
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnKeyDown(self, evt):
"""Capture the keypress when the notebook tab is focused.
Currently this is used to workaround a bug in Windows since the
notebook tab instead of the panel receives focus."""
if guiutil.IsMSWindows():
pub.sendMessage('main.key_down', evt)
示例12: OnStructureUncheck
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnStructureUncheck(self, msg):
"""Remove the unchecked structures."""
structure = msg.data
# Get the structure number
id = structure['data']['id']
# Remove the structure from the structure list
if self.structureList.has_key(id):
del self.structureList[id]
# Remove the structure from the structure choice box
for n in range(self.choiceStructure.GetCount()):
if (id == self.choiceStructure.GetClientData(n)):
# Save if the currently selected item's position
currSelection = self.choiceStructure.GetSelection()
self.choiceStructure.Delete(n)
break
# If the currently selected item will be deleted,
# select the last item instead
if (n == currSelection):
if (self.choiceStructure.GetCount() >= 1):
self.OnStructureSelect()
# Disable the control if it is the last item
if (self.choiceStructure.GetCount() == 0):
self.choiceStructure.Enable(False)
self.OnStructureUnselect()
pub.sendMessage('structures.checked', self.structureList)
示例13: OnStructureCheck
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnStructureCheck(self, msg):
"""Load the properties of the currently checked structures."""
structure = msg.data
# Get the structure number
id = structure['data']['id']
structure['data']['color'] = structure['color'].Get()
# Make sure that the volume has been calculated for each structure
# before setting it
if not self.structures[id].has_key('volume'):
# Use the volume units from the DVH if they are absolute volume
if self.dvhs.has_key(id) and (self.dvhs[id]['volumeunits'] == 'CM3'):
self.structures[id]['volume'] = self.dvhs[id]['data'][0]
# Otherwise calculate the volume from the structure data
else:
self.structures[id]['volume'] = dvhdata.CalculateVolume(
self.structures[id])
structure['data']['volume'] = self.structures[id]['volume']
self.structureList[id] = structure['data']
# Populate the structure choice box with the checked structures
self.choiceStructure.Enable()
i = self.choiceStructure.Append(structure['data']['name'])
self.choiceStructure.SetClientData(i, id)
# Select the first structure
self.OnStructureSelect()
pub.sendMessage('structures.checked', self.structureList)
示例14: OnUpdatePatientData
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def OnUpdatePatientData(self, patient):
"""Update the patient data in the main program interface."""
self.PopulateDemographics(patient)
self.structures = {}
if patient.has_key('structures'):
self.structures = patient['structures']
self.PopulateStructures()
if patient.has_key('plan'):
self.PopulatePlan(patient['plan'])
else:
self.PopulatePlan({})
if (patient.has_key('dose') and patient.has_key('plan')):
self.PopulateIsodoses(patient.has_key('images'), patient['plan'], patient['dose'])
else:
self.PopulateIsodoses(patient.has_key('images'), {}, {})
if patient.has_key('dvhs'):
self.dvhs = patient['dvhs']
else:
self.dvhs = {}
# Re-publish the raw data
pub.sendMessage('patient.updated.raw_data', self.ptdata)
# Publish the parsed data
pub.sendMessage('patient.updated.parsed_data', patient)
示例15: _update_strategy
# 需要导入模块: from wx.lib.pubsub import Publisher [as 别名]
# 或者: from wx.lib.pubsub.Publisher import sendMessage [as 别名]
def _update_strategy(self, value=None):
'''
Called when a control_panel's value is changed and is valid. Also
called when the user changes the method of a stage.
'''
strategy = self.get_current_strategy()
pub.sendMessage('SET_CURRENT_STRATEGY', data=strategy)