--- a/Beremiz.py Sun Mar 18 19:17:54 2012 +0100
+++ b/Beremiz.py Sun Mar 18 23:50:51 2012 +0100
@@ -144,6 +144,7 @@
import wx.lib.buttons, wx.lib.statbmp
import TextCtrlAutoComplete, cPickle
+from BrowseValuesLibraryDialog import BrowseValuesLibraryDialog import types, time, re, platform, time, traceback, commands
from plugger import PluginsRoot, MATIEC_ERROR_MODEL
from wxPopen import ProcessLogger
@@ -933,7 +934,7 @@
paramswindow = wx.Panel(rightwindow, -1, size=wx.Size(-1, -1))
paramswindow.SetBackgroundColour(bkgdclr)
- psizer = wx.BoxSizer(wx.HORIZONTAL)
+ psizer = wx.BoxSizer(wx.VERTICAL) paramswindow.SetSizer(psizer)
self.PluginInfos[plugin]["params"] = paramswindow
@@ -1004,7 +1005,7 @@
for child in self.PluginInfos[plugin]["children"]:
self.PluginInfos[child]["left"].Show()
self.PluginInfos[child]["right"].Show()
- if force or not self.PluginInfos[child]["expanded"]:
+ if force or self.PluginInfos[child]["expanded"]: self.ExpandPlugin(child, force)
self.PluginInfos[child]["expanded"] = True
@@ -1406,6 +1407,18 @@
+ def GetBrowseCallBackFunction(self, name, textctrl, library, value_infos, plugin, path): + def OnBrowseButton(event): + dialog = BrowseValuesLibraryDialog(self, name, library, infos[0]) + if dialog.ShowModal() == wx.ID_OK: + value, value_infos = self.SetPluginParamsAttribute(plugin, path, dialog.GetValueInfos()) + textctrl.ChangeValue(value) def ClearSizer(self, sizer):
for item in sizer.GetChildren():
@@ -1459,32 +1472,53 @@
boxsizer.AddWindow(statictext, 0, border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT)
if isinstance(element_infos["type"], types.ListType):
- combobox = wx.ComboBox(id=id, name=element_infos["name"], parent=parent,
- pos=wx.Point(0, 0), size=wx.Size(300, 28), style=wx.CB_READONLY)
- boxsizer.AddWindow(combobox, 0, border=0, flag=0)
- if element_infos["use"] == "optional":
- if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType):
- for choice, xsdclass in element_infos["type"]:
- combobox.Append(choice)
- name = element_infos["name"]
- value = element_infos["value"]
- staticbox = wx.StaticBox(id=-1, label="%s - %s"%(_(name), _(value)),
- name='%s_staticbox'%element_infos["name"], parent=parent,
- pos=wx.Point(0, 0), size=wx.Size(10, 0), style=0)
- staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
- sizer.AddSizer(staticboxsizer, 0, border=5, flag=wx.GROW|wx.BOTTOM)
- self.RefreshSizerElement(parent, staticboxsizer, plugin, element_infos["children"], element_path)
- callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, plugin, element_path)
+ if isinstance(element_infos["value"], types.TupleType): + browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL) + boxsizer.AddSizer(browse_boxsizer, 0, border=0, flag=0) + textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=parent, + pos=wx.Point(0, 0), size=wx.Size(275, 25), style=wx.TE_READONLY) + if element_infos["value"] is not None: + textctrl.SetValue(element_infos["value"][0]) + value_infos = element_infos["value"][1] + browse_boxsizer.AddWindow(textctrl, 0, border=0, flag=0) + button = wx.Button(id=button_id, name="browse_%s" % element_infos["name"], parent=parent, + label="...", pos=wx.Point(0, 0), size=wx.Size(25, 25)) + browse_boxsizer.AddWindow(button, 0, border=0, flag=0) + button.Bind(wx.EVT_BUTTON, + self.GetBrowseCallBackFunction(element_infos["name"], textctrl, element_infos["type"], + value_infos, plugin, element_path), - for choice in element_infos["type"]:
- combobox.Append(choice)
- callback = self.GetChoiceCallBackFunction(combobox, plugin, element_path)
- if element_infos["value"] is None:
- combobox.SetStringSelection("")
- combobox.SetStringSelection(element_infos["value"])
- combobox.Bind(wx.EVT_COMBOBOX, callback, id=id)
+ combobox = wx.ComboBox(id=id, name=element_infos["name"], parent=parent, + pos=wx.Point(0, 0), size=wx.Size(300, 28), style=wx.CB_READONLY) + boxsizer.AddWindow(combobox, 0, border=0, flag=0) + if element_infos["use"] == "optional": + if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType): + for choice, xsdclass in element_infos["type"]: + combobox.Append(choice) + name = element_infos["name"] + value = element_infos["value"] + staticbox = wx.StaticBox(id=-1, label="%s - %s"%(_(name), _(value)), + name='%s_staticbox'%element_infos["name"], parent=parent, + pos=wx.Point(0, 0), size=wx.Size(10, 0), style=0) + staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) + sizer.AddSizer(staticboxsizer, 0, border=5, flag=wx.GROW|wx.BOTTOM) + self.RefreshSizerElement(parent, staticboxsizer, plugin, element_infos["children"], element_path) + callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, plugin, element_path) + for choice in element_infos["type"]: + combobox.Append(choice) + callback = self.GetChoiceCallBackFunction(combobox, plugin, element_path) + if element_infos["value"] is None: + combobox.SetStringSelection("") + combobox.SetStringSelection(element_infos["value"]) + combobox.Bind(wx.EVT_COMBOBOX, callback, id=id) elif isinstance(element_infos["type"], types.DictType):
@@ -1496,14 +1530,16 @@
pos=wx.Point(0, 0), size=wx.Size(300, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
spinctrl.SetRange(scmin,scmax)
boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
- spinctrl.SetValue(element_infos["value"])
+ if element_infos["value"] is not None: + spinctrl.SetValue(element_infos["value"]) spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, plugin, element_path), id=id)
if element_infos["type"] == "boolean":
checkbox = wx.CheckBox(id=id, name=element_infos["name"], parent=parent,
pos=wx.Point(0, 0), size=wx.Size(17, 25), style=0)
boxsizer.AddWindow(checkbox, 0, border=0, flag=0)
- checkbox.SetValue(element_infos["value"])
+ if element_infos["value"] is not None: + checkbox.SetValue(element_infos["value"]) checkbox.Bind(wx.EVT_CHECKBOX, self.GetCheckBoxCallBackFunction(checkbox, plugin, element_path), id=id)
elif element_infos["type"] in ["unsignedLong", "long","integer"]:
if element_infos["type"].startswith("unsigned"):
@@ -1515,7 +1551,8 @@
pos=wx.Point(0, 0), size=wx.Size(300, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
spinctrl.SetRange(scmin, scmax)
boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
- spinctrl.SetValue(element_infos["value"])
+ if element_infos["value"] is not None: + spinctrl.SetValue(element_infos["value"]) spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, plugin, element_path), id=id)
choices = cPickle.loads(str(self.Config.Read(element_path, cPickle.dumps([""]))))
@@ -1530,7 +1567,8 @@
boxsizer.AddWindow(textctrl, 0, border=0, flag=0)
- textctrl.ChangeValue(str(element_infos["value"]))
+ if element_infos["value"] is not None: + textctrl.ChangeValue(str(element_infos["value"])) textctrl.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(textctrl, plugin, element_path))
--- a/plugger.py Sun Mar 18 19:17:54 2012 +0100
+++ b/plugger.py Sun Mar 18 23:50:51 2012 +0100
@@ -1781,7 +1781,7 @@
def RemoteExec(self, script, **kwargs):
if self._connector is None:
- return -1, "No runtime connected"
+ return -1, "No runtime connected!" return self._connector.RemoteExec(script, **kwargs)
def DebugThreadProc(self):
@@ -1823,11 +1823,12 @@
def KillDebugThread(self):
+ tmp_debugthread = self.DebugThread - if self.DebugThread is not None:
+ if tmp_debugthread is not None: self.logger.writeyield(_("Stopping debugger...\n"))
- self.DebugThread.join(timeout=5)
- if self.DebugThread.isAlive() and self.logger:
+ tmp_debugthread.join(timeout=5) + if tmp_debugthread.isAlive() and self.logger: self.logger.write_warning(_("Couldn't stop debugger.\n"))
self.logger.write(_("Debugger stopped.\n"))