477 st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"])) |
495 st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"])) |
478 st.SetLabel(self.PluginRoot.GetProjectName()) |
496 st.SetLabel(self.PluginRoot.GetProjectName()) |
479 plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER) |
497 plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER) |
480 |
498 |
481 addbutton_id = wx.NewId() |
499 addbutton_id = wx.NewId() |
482 addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')), |
500 addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Add.png')), |
483 name='AddPluginButton', parent=plcwindow, pos=wx.Point(0, 0), |
501 name='AddPluginButton', parent=plcwindow, pos=wx.Point(0, 0), |
484 size=wx.Size(16, 16), style=wx.NO_BORDER) |
502 size=wx.Size(16, 16), style=wx.NO_BORDER) |
485 addbutton.SetToolTipString("Add a sub plugin") |
503 addbutton.SetToolTipString("Add a sub plugin") |
486 addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id) |
504 addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id) |
487 plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
505 plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
507 |
525 |
508 if not self.PluginInfos[self.PluginRoot]["middle_visible"]: |
526 if not self.PluginInfos[self.PluginRoot]["middle_visible"]: |
509 paramswindow.Hide() |
527 paramswindow.Hide() |
510 |
528 |
511 minimizebutton_id = wx.NewId() |
529 minimizebutton_id = wx.NewId() |
512 minimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=minimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Maximize.png')), |
530 minimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=minimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Maximize.png')), |
513 name='MinimizeButton', parent=plcwindow, pos=wx.Point(0, 0), |
531 name='MinimizeButton', parent=plcwindow, pos=wx.Point(0, 0), |
514 size=wx.Size(24, 24), style=wx.NO_BORDER) |
532 size=wx.Size(24, 24), style=wx.NO_BORDER) |
515 make_genbitmaptogglebutton_flat(minimizebutton) |
533 make_genbitmaptogglebutton_flat(minimizebutton) |
516 minimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Minimize.png'))) |
534 minimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Minimize.png'))) |
517 plcwindowbuttonsizer.AddWindow(minimizebutton, 0, border=5, flag=wx.ALL) |
535 plcwindowbuttonsizer.AddWindow(minimizebutton, 0, border=5, flag=wx.ALL) |
518 |
536 |
519 # if len(self.PluginRoot.PlugChildsTypes) > 0: |
537 # if len(self.PluginRoot.PlugChildsTypes) > 0: |
520 # addsizer = self.GenerateAddButtonSizer(self.PluginRoot, plcwindow) |
538 # addsizer = self.GenerateAddButtonSizer(self.PluginRoot, plcwindow) |
521 # plcwindowbuttonsizer.AddSizer(addsizer, 0, border=0, flag=0) |
539 # plcwindowbuttonsizer.AddSizer(addsizer, 0, border=0, flag=0) |
573 msizer = wx.FlexGridSizer(cols=1) |
591 msizer = wx.FlexGridSizer(cols=1) |
574 for plugin_method in plugin.PluginMethods: |
592 for plugin_method in plugin.PluginMethods: |
575 if "method" in plugin_method and plugin_method.get("shown",True): |
593 if "method" in plugin_method and plugin_method.get("shown",True): |
576 id = wx.NewId() |
594 id = wx.NewId() |
577 button = GenBitmapTextButton(id=id, parent=parent, |
595 button = GenBitmapTextButton(id=id, parent=parent, |
578 bitmap=wx.Bitmap(os.path.join(CWD, "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], |
596 bitmap=wx.Bitmap(Bpath( "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], |
579 name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER) |
597 name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER) |
580 button.SetToolTipString(plugin_method["tooltip"]) |
598 button.SetToolTipString(plugin_method["tooltip"]) |
581 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id) |
599 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id) |
582 #hack to force size to mini |
600 #hack to force size to mini |
583 if not plugin_method.get("enabled",True): |
601 if not plugin_method.get("enabled",True): |
666 |
684 |
667 rolesizer = wx.BoxSizer(wx.HORIZONTAL) |
685 rolesizer = wx.BoxSizer(wx.HORIZONTAL) |
668 leftsizer.AddSizer(rolesizer, 0, border=0, flag=wx.GROW|wx.RIGHT) |
686 leftsizer.AddSizer(rolesizer, 0, border=0, flag=wx.GROW|wx.RIGHT) |
669 |
687 |
670 enablebutton_id = wx.NewId() |
688 enablebutton_id = wx.NewId() |
671 enablebutton = wx.lib.buttons.GenBitmapToggleButton(id=enablebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Disabled.png')), |
689 enablebutton = wx.lib.buttons.GenBitmapToggleButton(id=enablebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Disabled.png')), |
672 name='EnableButton', parent=leftwindow, size=wx.Size(16, 16), pos=wx.Point(0, 0), style=0)#wx.NO_BORDER) |
690 name='EnableButton', parent=leftwindow, size=wx.Size(16, 16), pos=wx.Point(0, 0), style=0)#wx.NO_BORDER) |
673 enablebutton.SetToolTipString("Enable/Disable this plugin") |
691 enablebutton.SetToolTipString("Enable/Disable this plugin") |
674 make_genbitmaptogglebutton_flat(enablebutton) |
692 make_genbitmaptogglebutton_flat(enablebutton) |
675 enablebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Enabled.png'))) |
693 enablebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Enabled.png'))) |
676 enablebutton.SetToggle(plugin.MandatoryParams[1].getEnabled()) |
694 enablebutton.SetToggle(plugin.MandatoryParams[1].getEnabled()) |
677 def toggleenablebutton(event): |
695 def toggleenablebutton(event): |
678 res = self.SetPluginParamsAttribute(plugin, "BaseParams.Enabled", enablebutton.GetToggle()) |
696 res = self.SetPluginParamsAttribute(plugin, "BaseParams.Enabled", enablebutton.GetToggle()) |
679 enablebutton.SetToggle(res) |
697 enablebutton.SetToggle(res) |
680 event.Skip() |
698 event.Skip() |
698 updownsizer = wx.BoxSizer(wx.VERTICAL) |
716 updownsizer = wx.BoxSizer(wx.VERTICAL) |
699 iecsizer.AddSizer(updownsizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL) |
717 iecsizer.AddSizer(updownsizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL) |
700 |
718 |
701 if plugin_IECChannel > 0: |
719 if plugin_IECChannel > 0: |
702 ieccdownbutton_id = wx.NewId() |
720 ieccdownbutton_id = wx.NewId() |
703 ieccdownbutton = wx.lib.buttons.GenBitmapButton(id=ieccdownbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'IECCDown.png')), |
721 ieccdownbutton = wx.lib.buttons.GenBitmapButton(id=ieccdownbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'IECCDown.png')), |
704 name='IECCDownButton', parent=leftwindow, pos=wx.Point(0, 0), |
722 name='IECCDownButton', parent=leftwindow, pos=wx.Point(0, 0), |
705 size=wx.Size(16, 16), style=wx.NO_BORDER) |
723 size=wx.Size(16, 16), style=wx.NO_BORDER) |
706 ieccdownbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel - 1), id=ieccdownbutton_id) |
724 ieccdownbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel - 1), id=ieccdownbutton_id) |
707 updownsizer.AddWindow(ieccdownbutton, 0, border=0, flag=wx.ALIGN_LEFT) |
725 updownsizer.AddWindow(ieccdownbutton, 0, border=0, flag=wx.ALIGN_LEFT) |
708 |
726 |
709 ieccupbutton_id = wx.NewId() |
727 ieccupbutton_id = wx.NewId() |
710 ieccupbutton = wx.lib.buttons.GenBitmapTextButton(id=ieccupbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'IECCUp.png')), |
728 ieccupbutton = wx.lib.buttons.GenBitmapTextButton(id=ieccupbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'IECCUp.png')), |
711 name='IECCUpButton', parent=leftwindow, pos=wx.Point(0, 0), |
729 name='IECCUpButton', parent=leftwindow, pos=wx.Point(0, 0), |
712 size=wx.Size(16, 16), style=wx.NO_BORDER) |
730 size=wx.Size(16, 16), style=wx.NO_BORDER) |
713 ieccupbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel + 1), id=ieccupbutton_id) |
731 ieccupbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel + 1), id=ieccupbutton_id) |
714 updownsizer.AddWindow(ieccupbutton, 0, border=0, flag=wx.ALIGN_LEFT) |
732 updownsizer.AddWindow(ieccupbutton, 0, border=0, flag=wx.ALIGN_LEFT) |
715 |
733 |
716 adddeletesizer = wx.BoxSizer(wx.VERTICAL) |
734 adddeletesizer = wx.BoxSizer(wx.VERTICAL) |
717 iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL) |
735 iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL) |
718 |
736 |
719 deletebutton_id = wx.NewId() |
737 deletebutton_id = wx.NewId() |
720 deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete.png')), |
738 deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Delete.png')), |
721 name='DeletePluginButton', parent=leftwindow, pos=wx.Point(0, 0), |
739 name='DeletePluginButton', parent=leftwindow, pos=wx.Point(0, 0), |
722 size=wx.Size(16, 16), style=wx.NO_BORDER) |
740 size=wx.Size(16, 16), style=wx.NO_BORDER) |
723 deletebutton.SetToolTipString("Delete this plugin") |
741 deletebutton.SetToolTipString("Delete this plugin") |
724 deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id) |
742 deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id) |
725 adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
743 adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
726 |
744 |
727 if len(plugin.PlugChildsTypes) > 0: |
745 if len(plugin.PlugChildsTypes) > 0: |
728 addbutton_id = wx.NewId() |
746 addbutton_id = wx.NewId() |
729 addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')), |
747 addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Add.png')), |
730 name='AddPluginButton', parent=leftwindow, pos=wx.Point(0, 0), |
748 name='AddPluginButton', parent=leftwindow, pos=wx.Point(0, 0), |
731 size=wx.Size(16, 16), style=wx.NO_BORDER) |
749 size=wx.Size(16, 16), style=wx.NO_BORDER) |
732 addbutton.SetToolTipString("Add a sub plugin") |
750 addbutton.SetToolTipString("Add a sub plugin") |
733 addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id) |
751 addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id) |
734 adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
752 adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER) |
735 |
753 |
736 expandbutton_id = wx.NewId() |
754 expandbutton_id = wx.NewId() |
737 expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'plus.png')), |
755 expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'plus.png')), |
738 name='ExpandButton', parent=leftwindow, pos=wx.Point(0, 0), |
756 name='ExpandButton', parent=leftwindow, pos=wx.Point(0, 0), |
739 size=wx.Size(13, 13), style=wx.NO_BORDER) |
757 size=wx.Size(13, 13), style=wx.NO_BORDER) |
740 expandbutton.labelDelta = 0 |
758 expandbutton.labelDelta = 0 |
741 expandbutton.SetBezelWidth(0) |
759 expandbutton.SetBezelWidth(0) |
742 expandbutton.SetUseFocusIndicator(False) |
760 expandbutton.SetUseFocusIndicator(False) |
743 expandbutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'minus.png'))) |
761 expandbutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'minus.png'))) |
744 expandbutton.SetToggle(self.PluginInfos[plugin]["expanded"]) |
762 expandbutton.SetToggle(self.PluginInfos[plugin]["expanded"]) |
745 |
763 |
746 if len(self.PluginInfos[plugin]["children"]) > 0: |
764 if len(self.PluginInfos[plugin]["children"]) > 0: |
747 def togglebutton(event): |
765 def togglebutton(event): |
748 if expandbutton.GetToggle(): |
766 if expandbutton.GetToggle(): |
765 tc.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(tc, plugin, "BaseParams.Name"), id=tc_id) |
783 tc.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(tc, plugin, "BaseParams.Name"), id=tc_id) |
766 iecsizer.AddWindow(tc, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL) |
784 iecsizer.AddWindow(tc, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL) |
767 |
785 |
768 |
786 |
769 leftminimizebutton_id = wx.NewId() |
787 leftminimizebutton_id = wx.NewId() |
770 leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'ShowVars.png')), |
788 leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'ShowVars.png')), |
771 name='MinimizeButton', parent=leftwindow, pos=wx.Point(0, 0), |
789 name='MinimizeButton', parent=leftwindow, pos=wx.Point(0, 0), |
772 size=wx.Size(24, 24), style=wx.NO_BORDER) |
790 size=wx.Size(24, 24), style=wx.NO_BORDER) |
773 make_genbitmaptogglebutton_flat(leftminimizebutton) |
791 make_genbitmaptogglebutton_flat(leftminimizebutton) |
774 leftminimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'HideVars.png'))) |
792 leftminimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'HideVars.png'))) |
775 leftminimizebutton.SetToggle(self.PluginInfos[plugin]["left_visible"]) |
793 leftminimizebutton.SetToggle(self.PluginInfos[plugin]["left_visible"]) |
776 def toggleleftwindow(event): |
794 def toggleleftwindow(event): |
777 if leftminimizebutton.GetToggle(): |
795 if leftminimizebutton.GetToggle(): |
778 leftwindowsizer.Show(1) |
796 leftwindowsizer.Show(1) |
779 else: |
797 else: |
827 |
845 |
828 if not self.PluginInfos[plugin]["middle_visible"]: |
846 if not self.PluginInfos[plugin]["middle_visible"]: |
829 paramswindow.Hide() |
847 paramswindow.Hide() |
830 |
848 |
831 middleminimizebutton_id = wx.NewId() |
849 middleminimizebutton_id = wx.NewId() |
832 middleminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=middleminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Maximize.png')), |
850 middleminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=middleminimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Maximize.png')), |
833 name='MinimizeButton', parent=middlewindow, pos=wx.Point(0, 0), |
851 name='MinimizeButton', parent=middlewindow, pos=wx.Point(0, 0), |
834 size=wx.Size(24, 24), style=wx.NO_BORDER) |
852 size=wx.Size(24, 24), style=wx.NO_BORDER) |
835 make_genbitmaptogglebutton_flat(middleminimizebutton) |
853 make_genbitmaptogglebutton_flat(middleminimizebutton) |
836 middleminimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Minimize.png'))) |
854 middleminimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Minimize.png'))) |
837 middleminimizebutton.SetToggle(self.PluginInfos[plugin]["middle_visible"]) |
855 middleminimizebutton.SetToggle(self.PluginInfos[plugin]["middle_visible"]) |
838 middleparamssizer.AddWindow(middleminimizebutton, 0, border=5, flag=wx.ALL) |
856 middleparamssizer.AddWindow(middleminimizebutton, 0, border=5, flag=wx.ALL) |
839 |
857 |
840 # rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
858 # rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
841 # rightwindow.SetBackgroundColour(wx.Colour(240,240,240)) |
859 # rightwindow.SetBackgroundColour(wx.Colour(240,240,240)) |