31 |
31 |
32 from editors.EditorPanel import EditorPanel |
32 from editors.EditorPanel import EditorPanel |
33 |
33 |
34 from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
34 from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
35 |
35 |
36 from controls import TextCtrlAutoComplete |
36 from controls import TextCtrlAutoComplete, UriLocationEditor |
37 from dialogs import BrowseValuesLibraryDialog |
37 from dialogs import BrowseValuesLibraryDialog |
38 from util.BitmapLibrary import GetBitmap |
38 from util.BitmapLibrary import GetBitmap |
39 |
39 |
40 if wx.Platform == '__WXMSW__': |
40 if wx.Platform == '__WXMSW__': |
41 faces = { |
41 faces = { |
335 # hack to force size to mini |
335 # hack to force size to mini |
336 if not confnode_method.get("enabled", True): |
336 if not confnode_method.get("enabled", True): |
337 button.Disable() |
337 button.Disable() |
338 msizer.AddWindow(button, flag=wx.ALIGN_CENTER) |
338 msizer.AddWindow(button, flag=wx.ALIGN_CENTER) |
339 return msizer |
339 return msizer |
|
340 |
|
341 def UriOptions(self, event): |
|
342 CTR = self.ParentWindow.CTR |
|
343 CTR_BeremizRoot = CTR.BeremizRoot |
|
344 CTR_AppFrame = CTR.AppFrame |
|
345 |
|
346 # Get connector uri |
|
347 uri = CTR_BeremizRoot.getURI_location().strip() |
|
348 dialog = UriLocationEditor.UriLocationEditor(CTR_AppFrame, uri) |
|
349 |
|
350 if dialog.ShowModal() == wx.ID_OK: |
|
351 CTR_BeremizRoot.setURI_location(dialog.GetURI()) |
|
352 if CTR._View is not None: |
|
353 CTR._View.RefreshView() |
|
354 if CTR_AppFrame is not None: |
|
355 CTR_AppFrame.RefreshTitle() |
|
356 CTR_AppFrame.RefreshFileMenu() |
|
357 CTR_AppFrame.RefreshEditMenu() |
|
358 CTR_AppFrame.RefreshPageTitles() |
|
359 |
|
360 dialog.Destroy() |
|
361 |
340 |
362 |
341 def GenerateSizerElements(self, sizer, elements, path, clean=True): |
363 def GenerateSizerElements(self, sizer, elements, path, clean=True): |
342 if clean: |
364 if clean: |
343 sizer.Clear(True) |
365 sizer.Clear(True) |
344 first = True |
366 first = True |
482 parent=self.ParamsEditor, |
504 parent=self.ParamsEditor, |
483 choices=choices, |
505 choices=choices, |
484 element_path=element_path, |
506 element_path=element_path, |
485 size=wx.Size(300, -1)) |
507 size=wx.Size(300, -1)) |
486 |
508 |
487 boxsizer.AddWindow(textctrl) |
509 if element_infos["name"] == "URI_location": |
|
510 uriSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0) |
|
511 uriSizer.AddGrowableCol(0) |
|
512 uriSizer.AddGrowableRow(0) |
|
513 |
|
514 self.EditButton = wx.Button(self.ParamsEditor, label='...', size=wx.Size(30, -1)) |
|
515 self.Bind(wx.EVT_BUTTON, self.UriOptions, self.EditButton) |
|
516 |
|
517 uriSizer.AddWindow(textctrl, flag=wx.GROW) |
|
518 uriSizer.AddWindow(self.EditButton, flag=wx.GROW) |
|
519 |
|
520 boxsizer.AddWindow(uriSizer) |
|
521 else: |
|
522 boxsizer.AddWindow(textctrl) |
|
523 |
488 if element_infos["value"] is not None: |
524 if element_infos["value"] is not None: |
489 textctrl.ChangeValue(str(element_infos["value"])) |
525 textctrl.ChangeValue(str(element_infos["value"])) |
490 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
526 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
491 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
527 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
492 textctrl.Bind(wx.EVT_TEXT, callback) |
528 textctrl.Bind(wx.EVT_TEXT, callback) |