The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 5ca3f3ba authored by eric pellegrini's avatar eric pellegrini
Browse files

Modified the sendMessage call according to the wx pubusb API

parent 5428380b
......@@ -71,16 +71,17 @@ class DataTreePanel(wx.Panel):
PUBLISHER.unsubscribe(self.msg_delete_input_data, 'msg_delete_input_data')
event.Skip()
def msg_load_input_data(self, data):
def msg_load_input_data(self,message):
data = message.data
if data is None:
return
self.add_data(data)
def msg_delete_input_data(self, data):
def msg_delete_input_data(self,message):
data = message.data
item = self.get_tree_item(self._root,data)
if item is None:
......@@ -111,7 +112,7 @@ class DataTreePanel(wx.Panel):
yield item
item = self._tree.GetNextSibling(item)
def add_data(self, data):
def add_data(self,data):
dataItem = wx.TreeItemData(data.name)
......
......@@ -149,8 +149,9 @@ class AnimationPlugin(ComponentPlugin):
self.speedSlider.SetValue(int(self.speedEntry.GetValue()))
self._parent.change_frame_rate()
def msg_timer(self, plugin):
def msg_timer(self, message):
plugin = message.data
if not plugin.is_parent(self):
return
......@@ -171,8 +172,9 @@ class AnimationPlugin(ComponentPlugin):
self._parent.start_stop_animation()
def msg_update_animation_icon(self, plugin):
def msg_update_animation_icon(self, message):
plugin = message.data
if not plugin.is_parent(self):
return
......@@ -181,8 +183,9 @@ class AnimationPlugin(ComponentPlugin):
else:
self.startStop.SetBitmapLabel(ICONS["play",32,32])
def msg_set_trajectory(self, plugin):
def msg_set_trajectory(self, message):
plugin = message.data
if not plugin.is_parent(self):
return
......
......@@ -344,7 +344,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
self._selectionSummary.Clear()
PUBLISHER.sendMessage('msg_clear_selection',plugin=self)
PUBLISHER.sendMessage('msg_clear_selection',data=self)
def on_display_keyword_values(self, event=None):
......@@ -384,7 +384,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
def msg_select_atoms_from_viewer(self, message):
dataPlugin,selection = message
dataPlugin,selection = message.data
if dataPlugin != get_data_plugin(self):
return
......@@ -397,7 +397,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
_, self._selection = self._query.parse()
PUBLISHER.sendMessage("msg_set_selection", plugin=self)
PUBLISHER.sendMessage("msg_set_selection", data=self)
@property
def selection(self):
......
......@@ -158,7 +158,7 @@ class IPlugin(wx.Panel):
self._currentWindow = self
PUBLISHER.sendMessage('msg_set_plugins_tree', plugin=self)
PUBLISHER.sendMessage('msg_set_plugins_tree', data=self)
def build_dialog(self):
......@@ -198,6 +198,6 @@ class IPlugin(wx.Panel):
self._currentWindow = window
PUBLISHER.sendMessage('msg_set_plugins_tree', plugin=window)
PUBLISHER.sendMessage('msg_set_plugins_tree', data=window)
\ No newline at end of file
......@@ -123,7 +123,7 @@ class JobPlugin(ComponentPlugin):
time.sleep(1)
PUBLISHER.sendMessage("msg_start_job",message=None)
PUBLISHER.sendMessage("msg_start_job",data=None)
def on_save(self, event=None):
......@@ -152,7 +152,7 @@ class JobPlugin(ComponentPlugin):
self._parent.mgr.Update()
PUBLISHER.sendMessage("msg_set_data", plugin=self)
PUBLISHER.sendMessage("msg_set_data", data=self)
def on_close(self, event):
......@@ -179,7 +179,7 @@ class JobFrame(wx.Frame):
plugin = REGISTRY['plugin'][self._jobType](self)
PUBLISHER.sendMessage("msg_set_data", plugin=plugin)
PUBLISHER.sendMessage("msg_set_data", data=plugin)
if __name__ == "__main__":
......
......@@ -231,8 +231,9 @@ class MolecularViewerPanel(ComponentPlugin):
del self._surface
self._surface = None
def msg_set_selection(self,plugin):
def msg_set_selection(self,message):
plugin = message.data
if not self.is_parent(plugin):
return
......@@ -240,7 +241,7 @@ class MolecularViewerPanel(ComponentPlugin):
def on_show_selection_box(self,message):
window,show = message
window,show = message.data
if get_data_plugin(self) != get_data_plugin(window):
return
......@@ -249,7 +250,7 @@ class MolecularViewerPanel(ComponentPlugin):
def on_enable_picking(self,message):
window,state = message
window,state = message.data
if get_data_plugin(self) != get_data_plugin(window):
return
......@@ -334,7 +335,7 @@ class MolecularViewerPanel(ComponentPlugin):
self._trajectoryLoaded = True
PUBLISHER.sendMessage('msg_set_trajectory', plugin=self)
PUBLISHER.sendMessage('msg_set_trajectory', data=self)
def color_string_to_RGB(self, s):
......@@ -597,7 +598,7 @@ class MolecularViewerPanel(ComponentPlugin):
self.set_configuration(self._timerCounter)
self._timerCounter += 1
PUBLISHER.sendMessage("msg_timer", plugin=self)
PUBLISHER.sendMessage("msg_timer", data=self)
def set_rendering_mode(self, mode):
if not self._trajectoryLoaded:
......@@ -677,7 +678,7 @@ class MolecularViewerPanel(ComponentPlugin):
self.show_selection(list(self.__pickedAtoms))
PUBLISHER.sendMessage('msg_select_atoms_from_viewer', message = (self.dataplugin,list(self.__pickedAtoms)))
PUBLISHER.sendMessage('msg_select_atoms_from_viewer', data=(self.dataplugin,list(self.__pickedAtoms)))
def box_atoms(self, atomsList):
......@@ -733,7 +734,7 @@ class MolecularViewerPanel(ComponentPlugin):
UD_STORE.save()
PUBLISHER.sendMessage("msg_set_ud")
PUBLISHER.sendMessage("msg_set_ud",data=None)
LOGGER('User definition %r successfully set.' % name,'info',['console'])
......@@ -784,15 +785,16 @@ class MolecularViewerPanel(ComponentPlugin):
self.stop_animation()
if check:
PUBLISHER.sendMessage("msg_switch_viewers_state", viewer=self)
PUBLISHER.sendMessage("msg_switch_viewers_state", data=self)
PUBLISHER.sendMessage('msg_animate_trajectory', plugin=self)
PUBLISHER.sendMessage('msg_animate_trajectory', data=self)
def msg_switch_viewers_state(self, viewer):
def msg_switch_viewers_state(self, message):
if not self._animationLoop:
return
viewer = message.data
if viewer==self:
return
......@@ -1002,8 +1004,9 @@ class MolecularViewerPanel(ComponentPlugin):
return assembly
def msg_clear_selection(self,plugin):
def msg_clear_selection(self,message):
plugin = message.data
if not self.is_parent(plugin):
return
......
......@@ -87,7 +87,7 @@ class UserDefinitionPlugin(ComponentPlugin):
UD_STORE.set_definition(self._target,self.type,name,value)
PUBLISHER.sendMessage("msg_set_ud")
PUBLISHER.sendMessage("msg_set_ud",data=None)
LOGGER('User definition %r successfully set.' % name,'info',['console'])
......
......@@ -169,11 +169,12 @@ class PluginsTreePanel(wx.Panel):
self.set_plugins_tree(subnode, v)
def msg_set_plugins_tree(self, plugin):
def msg_set_plugins_tree(self,message):
if self._tree.GetCount() !=0:
self._tree.DeleteChildren(self._root)
plugin = message.data
if plugin is None:
return
......
......@@ -203,7 +203,7 @@ class UserDefinitionViewer(wx.Dialog):
self._udTree.clear()
self._info.Clear()
PUBLISHER.sendMessage("msg_set_ud")
PUBLISHER.sendMessage("msg_set_ud",data=None)
def on_save_ud(self,event):
......
......@@ -129,7 +129,7 @@ class AtomSelectionWidget(UserDefinitionWidget):
else:
return uds
def msg_set_ud(self):
def msg_set_ud(self,message):
uds = UD_STORE.filter(self._basename, self.type)
......
......@@ -108,8 +108,9 @@ class IWidget(wx.Panel):
def set_data(self,datakey):
pass
def _set_data(self,plugin):
def _set_data(self,message):
plugin = message.data
if not plugin.is_parent(self):
return
......
......@@ -80,7 +80,7 @@ class McStasInstrumentWidget(IWidget):
self._instrument.Append(path)
self._instrument.Select(self._instrument.GetCount()-1)
PUBLISHER.sendMessage("msg_set_instrument", message = (self, instrParams))
PUBLISHER.sendMessage("msg_set_instrument", data=(self, instrParams))
def on_select_instrument(self, event):
......
......@@ -64,7 +64,7 @@ class NetCDFInputWidget(IWidget):
filename = event.GetString()
PUBLISHER.sendMessage("msg_set_netcdf", message=(self,filename))
PUBLISHER.sendMessage("msg_set_netcdf", data=(self,filename))
def set_data(self, datakey):
......@@ -77,7 +77,7 @@ class NetCDFInputWidget(IWidget):
self._selectNetCDF.SetStringSelection(datakey)
PUBLISHER.sendMessage("msg_set_netcdf", message = (self,datakey))
PUBLISHER.sendMessage("msg_set_netcdf", data=(self,datakey))
def get_widget_value(self):
......
......@@ -59,7 +59,7 @@ class UserDefinitionDialog(wx.Dialog):
self._plugin.set_trajectory(trajectory)
PUBLISHER.sendMessage("msg_set_data", plugin=self._plugin)
PUBLISHER.sendMessage("msg_set_data", data=self._plugin)
@property
def plugin(self):
......@@ -129,7 +129,7 @@ class UserDefinitionWidget(IWidget):
self.msg_set_ud()
def msg_set_ud(self):
def msg_set_ud(self,message):
uds = UD_STORE.filter(self._basename, self.type)
......
......@@ -121,7 +121,7 @@ class WorkingPanel(wx.Panel):
dataPlugin = self._notebook.GetPage(self._notebook.GetSelection())
PUBLISHER.sendMessage('msg_set_plugins_tree', plugin=dataPlugin)
PUBLISHER.sendMessage('msg_set_plugins_tree', data=dataPlugin)
def on_close_page(self, event):
......@@ -131,5 +131,5 @@ class WorkingPanel(wx.Panel):
return
if self._notebook.GetPageCount() == 1:
PUBLISHER.sendMessage('msg_set_plugins_tree', plugin=None)
PUBLISHER.sendMessage('msg_set_plugins_tree', data=None)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment