lpcmanager

Parents 0eb1016b8699
Children 7bfd512ed448
Removed incompatible crap, still a lot left. Now runs when launched from test .bat file.
  • +9 -209
    LPCManager.py
  • --- a/LPCManager.py Thu Jan 18 10:59:37 2018 +0100
    +++ b/LPCManager.py Fri Jan 19 15:15:47 2018 +0100
    @@ -120,8 +120,6 @@
    _lpcmanager_path = os.path.split(__file__)[0]
    -sys.path.append(os.path.join(_lpcmanager_path, "SmartehWidgets"))
    -import SmartehWidgets.SmartehScreenSplash as splash
    import features
    from POULibrary import POULibrary
    @@ -193,8 +191,6 @@
    from types import MethodType
    from IDEFrame import IDEFrame
    from dialogs import SearchInProjectDialog
    -from UriLocationEditor import UriLocationEditor
    -from UriLocationEditor import UriTextControl
    from controls import TextCtrlAutoComplete
    from controls.LocationCellEditor import LocationCellControl, LocationCellEditor
    from dialogs.BrowseLocationsDialog import BrowseLocationsDialog
    @@ -475,195 +471,6 @@
    ("runtime_%s.py" % location_str, file(runtimefile_path, "rb")))
    PythonFileCTNMixin.CTNGenerate_C = CTNGenerate_C
    -def GenerateSizerElements(self, sizer, elements, path, clean=True):
    - def UriOptions(event):
    - CTR = self.ParentWindow.CTR
    - CTR_BeremizRoot = CTR.BeremizRoot
    - CTR_AppFrame = CTR.AppFrame
    - # Get connector uri
    - uri = CTR_BeremizRoot.getURI_location().strip()
    -
    - dialog = UriLocationEditor(CTR_AppFrame, uri)
    - answer = dialog.ShowModal()
    - uri = dialog.GetURI()
    - dialog.Destroy()
    -
    - if answer == wx.ID_OK:
    - CTR_BeremizRoot.setURI_location(uri)
    - if CTR._View is not None:
    - CTR._View.RefreshView()
    - if CTR_AppFrame is not None:
    - CTR_AppFrame.RefreshTitle()
    - CTR_AppFrame.RefreshFileMenu()
    - CTR_AppFrame.RefreshEditMenu()
    - CTR_AppFrame.RefreshPageTitles()
    - import types
    - from editors.ConfTreeNodeEditor import GenStaticBitmap
    -
    - if clean:
    - sizer.Clear(True)
    - first = True
    - for element_infos in elements:
    - if path:
    - element_path = "%s.%s" % (path, element_infos["name"])
    - else:
    - element_path = element_infos["name"]
    - if element_infos["type"] == "element":
    - name = element_infos["name"]
    - value = element_infos["value"]
    - label = _(name)
    - if value is not None:
    - label += " - %s" % _(value)
    - staticbox = wx.StaticBox(self.ParamsEditor,
    - label=_(label), size=wx.Size(10, 0))
    - staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
    - flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
    - if first:
    - flags |= wx.TOP
    - sizer.AddSizer(staticboxsizer, border=5, flag=flags)
    - self.GenerateSizerElements(staticboxsizer,
    - element_infos["children"],
    - element_path)
    - else:
    - boxsizer = wx.FlexGridSizer(cols=3, rows=1)
    - boxsizer.AddGrowableCol(1)
    - flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
    - if first:
    - flags |= wx.TOP
    - sizer.AddSizer(boxsizer, border=5, flag=flags)
    - staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"],
    - name="%s_bitmap" % element_infos["name"], parent=self.ParamsEditor,
    - pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0)
    - boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT)
    -
    - statictext = wx.StaticText(self.ParamsEditor,
    - label="%s:" % _(element_infos["name"]))
    - boxsizer.AddWindow(statictext, border=5,
    - flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
    -
    - if isinstance(element_infos["type"], types.ListType):
    - if isinstance(element_infos["value"], types.TupleType):
    - browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
    - boxsizer.AddSizer(browse_boxsizer)
    -
    - textctrl = wx.TextCtrl(self.ParamsEditor,
    - size=wx.Size(275, -1), style=wx.TE_READONLY)
    - if element_infos["value"] is not None:
    - textctrl.SetValue(element_infos["value"][0])
    - value_infos = element_infos["value"][1]
    - else:
    - value_infos = None
    - browse_boxsizer.AddWindow(textctrl)
    -
    - button = wx.Button(self.ParamsEditor,
    - label="...", size=wx.Size(25, 25))
    - browse_boxsizer.AddWindow(button)
    - button.Bind(wx.EVT_BUTTON,
    - self.GetBrowseCallBackFunction(element_infos["name"], textctrl, element_infos["type"],
    - value_infos, element_path),
    - button)
    - else:
    - combobox = wx.ComboBox(self.ParamsEditor,
    - size=wx.Size(300, -1), style=wx.CB_READONLY)
    - boxsizer.AddWindow(combobox)
    -
    - if element_infos["use"] == "optional":
    - combobox.Append("")
    - 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(self.ParamsEditor,
    - label="%s - %s" % (_(name), _(value)), size=wx.Size(10, 0))
    - staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
    - sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
    - self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path)
    - callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path)
    - else:
    - for choice in element_infos["type"]:
    - combobox.Append(choice)
    - callback = self.GetChoiceCallBackFunction(combobox, element_path)
    - if element_infos["value"] is None:
    - combobox.SetStringSelection("")
    - else:
    - combobox.SetStringSelection(element_infos["value"])
    - combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
    -
    - elif isinstance(element_infos["type"], types.DictType):
    - scmin = -(2 ** 31)
    - scmax = 2 ** 31 - 1
    - if "min" in element_infos["type"]:
    - scmin = element_infos["type"]["min"]
    - if "max" in element_infos["type"]:
    - scmax = element_infos["type"]["max"]
    - spinctrl = wx.SpinCtrl(self.ParamsEditor,
    - size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
    - spinctrl.SetRange(scmin, scmax)
    - boxsizer.AddWindow(spinctrl)
    - if element_infos["value"] is not None:
    - spinctrl.SetValue(element_infos["value"])
    - spinctrl.Bind(wx.EVT_SPINCTRL,
    - self.GetTextCtrlCallBackFunction(spinctrl, element_path),
    - spinctrl)
    -
    - else:
    - if element_infos["type"] == "boolean":
    - checkbox = wx.CheckBox(self.ParamsEditor, size=wx.Size(17, 25))
    - boxsizer.AddWindow(checkbox)
    - if element_infos["value"] is not None:
    - checkbox.SetValue(element_infos["value"])
    - checkbox.Bind(wx.EVT_CHECKBOX,
    - self.GetCheckBoxCallBackFunction(checkbox, element_path),
    - checkbox)
    -
    - elif element_infos["type"] in ["unsignedLong", "long", "integer"]:
    - if element_infos["type"].startswith("unsigned"):
    - scmin = 0
    - else:
    - scmin = -(2 ** 31)
    - scmax = 2 ** 31 - 1
    - spinctrl = wx.SpinCtrl(self.ParamsEditor,
    - size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
    - spinctrl.SetRange(scmin, scmax)
    - boxsizer.AddWindow(spinctrl)
    - if element_infos["value"] is not None:
    - spinctrl.SetValue(element_infos["value"])
    - spinctrl.Bind(wx.EVT_SPINCTRL,
    - self.GetTextCtrlCallBackFunction(spinctrl, element_path),
    - spinctrl)
    -
    - else:
    - choices = self.ParentWindow.GetConfigEntry(element_path, [""])
    - CTR = self.ParentWindow.CTR
    - if element_infos["name"] == "URI_location":
    - textctrl = UriTextControl(name=element_infos["name"],
    - parent=self.ParamsEditor,
    - choices=choices,
    - element_path=element_path,
    - size=wx.Size(300, -1),
    - Click=True,
    - function=UriOptions)
    - else:
    - textctrl = TextCtrlAutoComplete(name=element_infos["name"],
    - parent=self.ParamsEditor,
    - choices=choices,
    - element_path=element_path,
    - size=wx.Size(300, -1))
    -
    - boxsizer.AddWindow(textctrl)
    - if element_infos["value"] is not None:
    - textctrl.ChangeValue(str(element_infos["value"]))
    - callback = self.GetTextCtrlCallBackFunction(textctrl, element_path)
    - textctrl.Bind(wx.EVT_TEXT_ENTER, callback)
    - textctrl.Bind(wx.EVT_TEXT, callback)
    - textctrl.Bind(wx.EVT_KILL_FOCUS, callback)
    - first = False
    - sizer.Layout()
    - self.RefreshScrollbars()
    -ConfTreeNodeEditor.GenerateSizerElements = GenerateSizerElements
    -
    def ResetSearchResults(self):
    self.Highlights = []
    self.SearchParams = None
    @@ -2411,11 +2218,12 @@
    def Show(self, loading=True):
    wx.Frame.Show(self)
    - if loading:
    - loading_splash = splash.SmartehScreenSplash(self, bitmap=GetPath(splash.SPLASH_FN), signal=signal_init)
    - thread = Thread(target=loading_splash.Show)
    - thread.start()
    - #thread.join()
    + # WTF, really ?
    + # if loading:
    + # loading_splash = splash.SmartehScreenSplash(self, bitmap=GetPath(splash.SPLASH_FN), signal=signal_init)
    + # thread = Thread(target=loading_splash.Show)
    + # thread.start()
    + # #thread.join()
    def CheckEnabler(self, event):
    global _checkBlocks
    @@ -2944,13 +2752,6 @@
    lpcberemiz_cmd = LPCBeremiz_Cmd(CTR, Log)
    lpcberemiz_cmd.cmdloop()
    - def ResetwxGlade():
    - # reset pid of running wxGlade
    - config = wx.ConfigBase.Get()
    - wxGladePid = 0
    - config.Write("BeremizRoot.wxGlade", str(wxGladePid))
    - config.Flush()
    -
    Log = StdoutPseudoFile(port)
    if projectOpen is not None:
    @@ -2970,10 +2771,9 @@
    cmd_thread.start()
    # Install a exception handle for bug reports
    - AddExceptHook(os.getcwd(), __version__)
    + import util.ExceptionHandler
    + util.ExceptionHandler.AddExceptHook(version.app_version)
    frame = LPCBeremiz(None, ctr=CTR, debug=True)
    - ResetwxGlade()
    -
    - app.MainLoop()
    \ No newline at end of file
    + app.MainLoop()