equal
deleted
inserted
replaced
1 |
1 |
2 import os |
2 import os |
3 import types |
3 import types |
4 |
4 |
5 import wx |
5 import wx |
6 import wx.lib.buttons |
|
7 |
6 |
8 from EditorPanel import EditorPanel |
7 from EditorPanel import EditorPanel |
9 |
8 |
10 from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
9 from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
11 |
10 |
32 |
31 |
33 CWD = os.path.split(os.path.realpath(__file__))[0] |
32 CWD = os.path.split(os.path.realpath(__file__))[0] |
34 |
33 |
35 def Bpath(*args): |
34 def Bpath(*args): |
36 return os.path.join(CWD,*args) |
35 return os.path.join(CWD,*args) |
37 |
|
38 # Patch wx.lib.imageutils so that gray is supported on alpha images |
|
39 import wx.lib.imageutils |
|
40 from wx.lib.imageutils import grayOut as old_grayOut |
|
41 def grayOut(anImage): |
|
42 if anImage.HasAlpha(): |
|
43 AlphaData = anImage.GetAlphaData() |
|
44 else : |
|
45 AlphaData = None |
|
46 |
|
47 old_grayOut(anImage) |
|
48 |
|
49 if AlphaData is not None: |
|
50 anImage.SetAlphaData(AlphaData) |
|
51 |
|
52 wx.lib.imageutils.grayOut = grayOut |
|
53 |
36 |
54 class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton): |
37 class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton): |
55 def _GetLabelSize(self): |
38 def _GetLabelSize(self): |
56 """ used internally """ |
39 """ used internally """ |
57 w, h = self.GetTextExtent(self.GetLabel()) |
40 w, h = self.GetTextExtent(self.GetLabel()) |
331 if path: |
314 if path: |
332 element_path = "%s.%s"%(path, element_infos["name"]) |
315 element_path = "%s.%s"%(path, element_infos["name"]) |
333 else: |
316 else: |
334 element_path = element_infos["name"] |
317 element_path = element_infos["name"] |
335 if element_infos["type"] == "element": |
318 if element_infos["type"] == "element": |
336 label = element_infos["name"] |
319 name = element_infos["name"] |
|
320 value = element_infos["value"] |
|
321 label = _(name) |
|
322 if value is not None: |
|
323 label += " - %s" % _(value) |
337 staticbox = wx.StaticBox(self.ParamsEditor, |
324 staticbox = wx.StaticBox(self.ParamsEditor, |
338 label=_(label), size=wx.Size(10, 0)) |
325 label=_(label), size=wx.Size(10, 0)) |
339 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
326 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
340 if first: |
327 if first: |
341 sizer.AddSizer(staticboxsizer, border=5, |
328 sizer.AddSizer(staticboxsizer, border=5, |
507 return OnButtonClick |
494 return OnButtonClick |
508 |
495 |
509 def GetChoiceCallBackFunction(self, choicectrl, path): |
496 def GetChoiceCallBackFunction(self, choicectrl, path): |
510 def OnChoiceChanged(event): |
497 def OnChoiceChanged(event): |
511 res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
498 res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
|
499 if res is None: |
|
500 res = "" |
512 choicectrl.SetStringSelection(res) |
501 choicectrl.SetStringSelection(res) |
513 event.Skip() |
502 event.Skip() |
514 return OnChoiceChanged |
503 return OnChoiceChanged |
515 |
504 |
516 def GetChoiceContentCallBackFunction(self, choicectrl, staticboxsizer, path): |
505 def GetChoiceContentCallBackFunction(self, choicectrl, staticboxsizer, path): |