Commit 48c51610a1232afb6368cbf4cb7ae5c5dc34fc99
1 parent
148fb4bc
Exists in
master
and in
68 other branches
ENH: Default task panel
Showing
2 changed files
with
68 additions
and
22 deletions
Show diff stats
invesalius/gui/task_generic.py
... | ... | @@ -17,8 +17,12 @@ |
17 | 17 | # detalhes. |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | |
20 | +import os | |
21 | +import sys | |
22 | + | |
20 | 23 | import wx |
21 | - | |
24 | +import wx.lib.hyperlink as hl | |
25 | + | |
22 | 26 | class TaskPanel(wx.Panel): |
23 | 27 | """ |
24 | 28 | This panel works as a "frame", drawing a white margin arround |
... | ... | @@ -28,9 +32,11 @@ class TaskPanel(wx.Panel): |
28 | 32 | # note: don't change this class!!! |
29 | 33 | wx.Panel.__init__(self, parent) |
30 | 34 | |
35 | + inner_panel = InnerTaskPanel(self) | |
36 | + | |
31 | 37 | sizer = wx.BoxSizer(wx.HORIZONTAL) |
32 | - sizer.Add(InnerTaskPanel(self), 1, wx.EXPAND | wx.GROW | | |
33 | - wx.BOTTOM | wx.RIGHT | wx.LEFT, 7) | |
38 | + sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | | |
39 | + wx.LEFT, 7) | |
34 | 40 | sizer.Fit(self) |
35 | 41 | |
36 | 42 | self.SetSizer(sizer) |
... | ... | @@ -44,10 +50,31 @@ class InnerTaskPanel(wx.Panel): |
44 | 50 | self.SetBackgroundColour(wx.Colour(255,255,255)) |
45 | 51 | self.SetAutoLayout(1) |
46 | 52 | |
53 | + # Build GUI | |
54 | + self.__init_gui() | |
55 | + | |
47 | 56 | # Bind events |
48 | 57 | self.__bind_events() |
49 | 58 | self.__bind_wx_events() |
50 | 59 | |
60 | + def __init_gui(self): | |
61 | + """ | |
62 | + Build widgets in current panel | |
63 | + """ | |
64 | + # Create widgets to be inserted in this panel | |
65 | + link_test = hl.HyperLinkCtrl(self, -1, _("Testing...")) | |
66 | + link_test.SetUnderlines(False, False, False) | |
67 | + link_test.SetColours("BLACK", "BLACK", "BLACK") | |
68 | + link_test.AutoBrowse(False) | |
69 | + link_test.UpdateLink() | |
70 | + self.link_test = link_test | |
71 | + | |
72 | + # Add line sizers into main sizer | |
73 | + sizer = wx.BoxSizer(wx.VERTICAL) | |
74 | + sizer.Add(link_test, 0, wx.GROW|wx.EXPAND) | |
75 | + self.SetSizer(sizer) | |
76 | + self.Fit() | |
77 | + | |
51 | 78 | def __bind_events(self): |
52 | 79 | """ |
53 | 80 | Bind pubsub events |
... | ... | @@ -60,4 +87,11 @@ class InnerTaskPanel(wx.Panel): |
60 | 87 | Bind wx general events |
61 | 88 | """ |
62 | 89 | # Example: self.Bind(wx.EVT_BUTTON, self.OnButton) |
63 | - pass | |
90 | + self.link_test.Bind(hl.EVT_HYPERLINK_LEFT, self.OnTest) | |
91 | + | |
92 | + def OnTest(self, event): | |
93 | + """ | |
94 | + Describe what this method does | |
95 | + """ | |
96 | + event.Skip() | |
97 | + | ... | ... |
invesalius/gui/task_navigator.py
... | ... | @@ -22,12 +22,6 @@ import sys |
22 | 22 | |
23 | 23 | import wx |
24 | 24 | import wx.lib.hyperlink as hl |
25 | -#import wx.lib.platebtn as pbtn | |
26 | -#import wx.lib.pubsub as ps | |
27 | - | |
28 | -#import constants as const | |
29 | -#import gui.dialogs as dlg | |
30 | -#import project as proj | |
31 | 25 | |
32 | 26 | class TaskPanel(wx.Panel): |
33 | 27 | """ |
... | ... | @@ -38,9 +32,11 @@ class TaskPanel(wx.Panel): |
38 | 32 | # note: don't change this class!!! |
39 | 33 | wx.Panel.__init__(self, parent) |
40 | 34 | |
35 | + inner_panel = InnerTaskPanel(self) | |
36 | + | |
41 | 37 | sizer = wx.BoxSizer(wx.HORIZONTAL) |
42 | - sizer.Add(InnerTaskPanel(self), 1, wx.EXPAND | wx.GROW | | |
43 | - wx.BOTTOM | wx.RIGHT | wx.LEFT, 7) | |
38 | + sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | | |
39 | + wx.LEFT, 7) | |
44 | 40 | sizer.Fit(self) |
45 | 41 | |
46 | 42 | self.SetSizer(sizer) |
... | ... | @@ -54,20 +50,30 @@ class InnerTaskPanel(wx.Panel): |
54 | 50 | self.SetBackgroundColour(wx.Colour(255,255,255)) |
55 | 51 | self.SetAutoLayout(1) |
56 | 52 | |
53 | + # Build GUI | |
54 | + self.__init_gui() | |
55 | + | |
57 | 56 | # Bind events |
58 | 57 | self.__bind_events() |
59 | 58 | self.__bind_wx_events() |
60 | 59 | |
61 | 60 | def __init_gui(self): |
62 | - link_export_picture = hl.HyperLinkCtrl(self, -1, | |
63 | - _("Testing...")) | |
64 | - link_export_picture.SetUnderlines(False, False, False) | |
65 | - link_export_picture.SetColours("BLACK", "BLACK", "BLACK") | |
66 | - link_export_picture.SetToolTip(tooltip) | |
67 | - link_export_picture.AutoBrowse(False) | |
68 | - link_export_picture.UpdateLink() | |
69 | - #link_export_picture.Bind(hl.EVT_HYPERLINK_LEFT, | |
70 | - # self.OnLinkExportPicture) | |
61 | + """ | |
62 | + Build widgets in current panel | |
63 | + """ | |
64 | + # Create widgets to be inserted in this panel | |
65 | + link_test = hl.HyperLinkCtrl(self, -1, _("Testing...")) | |
66 | + link_test.SetUnderlines(False, False, False) | |
67 | + link_test.SetColours("BLACK", "BLACK", "BLACK") | |
68 | + link_test.AutoBrowse(False) | |
69 | + link_test.UpdateLink() | |
70 | + self.link_test = link_test | |
71 | + | |
72 | + # Add line sizers into main sizer | |
73 | + sizer = wx.BoxSizer(wx.VERTICAL) | |
74 | + sizer.Add(link_test, 0, wx.GROW|wx.EXPAND) | |
75 | + self.SetSizer(sizer) | |
76 | + self.Fit() | |
71 | 77 | |
72 | 78 | def __bind_events(self): |
73 | 79 | """ |
... | ... | @@ -81,4 +87,10 @@ class InnerTaskPanel(wx.Panel): |
81 | 87 | Bind wx general events |
82 | 88 | """ |
83 | 89 | # Example: self.Bind(wx.EVT_BUTTON, self.OnButton) |
84 | - pass | |
90 | + self.link_test.Bind(hl.EVT_HYPERLINK_LEFT, self.OnTest) | |
91 | + | |
92 | + def OnTest(self, event): | |
93 | + """ | |
94 | + Describe what this method does | |
95 | + """ | |
96 | + event.Skip() | ... | ... |