--- a/controls/PouInstanceVariablesPanel.py Fri Jun 15 18:03:25 2012 +0200
+++ b/controls/PouInstanceVariablesPanel.py Mon Jun 25 20:03:53 2012 +0200
@@ -27,6 +27,7 @@
import wx.lib.agw.customtreectrl as CT
from PLCControler import ITEMS_VARIABLE, ITEM_CONFIGURATION, ITEM_RESOURCE, ITEM_POU
+from utils.BitmapLibrary import GetBitmap
class PouInstanceVariablesPanel(wx.Panel):
@@ -35,32 +36,24 @@
parent=parent, pos=wx.Point(0, 0),
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
- self.ParentButton = wx.lib.buttons.GenBitmapButton(
- name='ParentButton', parent=self,
- bitmap=window.GenerateBitmap("up"),
- pos=wx.Point(0, 0), size=wx.Size(28, 28),
- style=wx.NO_BORDER)
+ self.ParentButton = wx.lib.buttons.GenBitmapButton(self,
+ bitmap=GetBitmap("top"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ self.ParentButton.SetToolTipString(_("Parent instance"))
self.Bind(wx.EVT_BUTTON, self.OnParentButtonClick,
self.ParentButton)
- self.InstanceChoice = wx.ComboBox(name='InstanceChoice',
- parent=self, pos=wx.Point(0, 0),
- size=wx.Size(0, 28), style=wx.CB_READONLY)
+ self.InstanceChoice = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnInstanceChoiceChanged,
self.InstanceChoice)
self.InstanceChoice.Bind(wx.EVT_LEFT_DOWN, self.OnInstanceChoiceLeftDown)
- self.DebugButton = wx.lib.buttons.GenBitmapButton(
- name='DebugButton', parent=self,
- bitmap=window.GenerateBitmap("debug"),
- pos=wx.Point(0, 0), size=wx.Size(28, 28),
- style=wx.NO_BORDER)
+ self.DebugButton = wx.lib.buttons.GenBitmapButton(self,
+ bitmap=GetBitmap("debug_instance"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ self.ParentButton.SetToolTipString(_("Debug instance"))
self.Bind(wx.EVT_BUTTON, self.OnDebugButtonClick,
self.DebugButton)
- self.VariablesList = CT.CustomTreeCtrl(
- name='VariablesList', parent=self,
- pos=wx.Point(0, 0), size=wx.Size(0, 0),
+ self.VariablesList = CT.CustomTreeCtrl(self,
style=wx.SUNKEN_BORDER,
agwStyle=CT.TR_NO_BUTTONS|
CT.TR_SINGLE|
@@ -76,15 +69,15 @@
self.VariablesList.Bind(wx.EVT_LEFT_DOWN, self.OnVariablesListLeftDown)
buttons_sizer = wx.FlexGridSizer(cols=3, hgap=0, rows=1, vgap=0)
- buttons_sizer.AddWindow(self.ParentButton, 0, border=0, flag=0)
- buttons_sizer.AddWindow(self.InstanceChoice, 0, border=0, flag=wx.GROW)
- buttons_sizer.AddWindow(self.DebugButton, 0, border=0, flag=0)
+ buttons_sizer.AddWindow(self.ParentButton)
+ buttons_sizer.AddWindow(self.InstanceChoice, flag=wx.GROW)
+ buttons_sizer.AddWindow(self.DebugButton)
buttons_sizer.AddGrowableCol(1)
buttons_sizer.AddGrowableRow(0)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
- main_sizer.AddSizer(buttons_sizer, 0, border=0, flag=wx.GROW)
- main_sizer.AddWindow(self.VariablesList, 0, border=0, flag=wx.GROW)
+ main_sizer.AddSizer(buttons_sizer, flag=wx.GROW)
+ main_sizer.AddWindow(self.VariablesList, flag=wx.GROW)
main_sizer.AddGrowableCol(0)
main_sizer.AddGrowableRow(1)
@@ -151,22 +144,22 @@
if (var_infos["debug"] and self.Debug and
(self.Controller.IsOfType(var_infos["type"], "ANY_NUM", True) or
self.Controller.IsOfType(var_infos["type"], "ANY_BIT", True))):
- graph_button = wx.lib.buttons.GenBitmapButton(name="graph",
- parent=panel, bitmap=self.ParentWindow.GenerateBitmap("graph"),
- pos=wx.Point(0, 0), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ graph_button = wx.lib.buttons.GenBitmapButton(panel,
+ bitmap=GetBitmap("instance_graph"),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
self.Bind(wx.EVT_BUTTON, self.GenGraphButtonCallback(var_infos), graph_button)
buttons.append(graph_button)
elif var_infos["edit"]:
- edit_button = wx.lib.buttons.GenBitmapButton(name="edit",
- parent=panel, bitmap=self.ParentWindow.GenerateBitmap("edit"),
- pos=wx.Point(0, 0), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ edit_button = wx.lib.buttons.GenBitmapButton(panel,
+ bitmap=GetBitmap("edit"),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
self.Bind(wx.EVT_BUTTON, self.GenEditButtonCallback(var_infos), edit_button)
buttons.append(edit_button)
if var_infos["debug"] and self.Debug:
- debug_button = wx.lib.buttons.GenBitmapButton(name="debug",
- parent=panel, bitmap=self.ParentWindow.GenerateBitmap("debug"),
- pos=wx.Point(0, 0), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ debug_button = wx.lib.buttons.GenBitmapButton(panel,
+ bitmap=GetBitmap("debug_instance"),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
self.Bind(wx.EVT_BUTTON, self.GenDebugButtonCallback(var_infos), debug_button)
buttons.append(debug_button)