Commit a6544b81d646b0254d4e6c618ab4ee9b5d13ee0c
1 parent
d13471c5
Exists in
master
and in
68 other branches
ENH: Measures on toolbar
Showing
2 changed files
with
47 additions
and
11 deletions
Show diff stats
invesalius/gui/default_tasks.py
| @@ -144,15 +144,15 @@ class LowerTaskPanel(wx.Panel): | @@ -144,15 +144,15 @@ class LowerTaskPanel(wx.Panel): | ||
| 144 | # Fold 2 - Tools | 144 | # Fold 2 - Tools |
| 145 | # Measures | 145 | # Measures |
| 146 | # Text Annotations | 146 | # Text Annotations |
| 147 | - item = fold_panel.AddFoldPanel(_("Tools"), collapsed=False, | ||
| 148 | - foldIcons=image_list) | ||
| 149 | - style = fold_panel.GetCaptionStyle(item) | ||
| 150 | - col = style.GetFirstColour() | ||
| 151 | - self.enable_items.append(item) | ||
| 152 | - | ||
| 153 | - fold_panel.AddFoldPanelWindow(item, tools.TaskPanel(item), Spacing= 0, | ||
| 154 | - leftSpacing=0, rightSpacing=0) | ||
| 155 | - fold_panel.Expand(fold_panel.GetFoldPanel(1)) | 147 | + #item = fold_panel.AddFoldPanel(_("Tools"), collapsed=False, |
| 148 | + # foldIcons=image_list) | ||
| 149 | + #style = fold_panel.GetCaptionStyle(item) | ||
| 150 | + #col = style.GetFirstColour() | ||
| 151 | + #elf.enable_items.append(item) | ||
| 152 | + # | ||
| 153 | + #fold_panel.AddFoldPanelWindow(item, tools.TaskPanel(item), Spacing= 0, | ||
| 154 | + # leftSpacing=0, rightSpacing=0) | ||
| 155 | + #fold_panel.Expand(fold_panel.GetFoldPanel(1)) | ||
| 156 | 156 | ||
| 157 | self.SetStateProjectClose() | 157 | self.SetStateProjectClose() |
| 158 | self.__bind_events() | 158 | self.__bind_events() |
invesalius/gui/frame.py
| @@ -781,8 +781,10 @@ class ObjectToolBar(wx.ToolBar): | @@ -781,8 +781,10 @@ class ObjectToolBar(wx.ToolBar): | ||
| 781 | # not. Eg. save should only be available if a project is open | 781 | # not. Eg. save should only be available if a project is open |
| 782 | self.enable_items = [const.STATE_WL, const.STATE_PAN, | 782 | self.enable_items = [const.STATE_WL, const.STATE_PAN, |
| 783 | const.STATE_SPIN, const.STATE_ZOOM_SL, | 783 | const.STATE_SPIN, const.STATE_ZOOM_SL, |
| 784 | - const.STATE_ZOOM] | ||
| 785 | - | 784 | + const.STATE_ZOOM, |
| 785 | + const.STATE_MEASURE_DISTANCE, | ||
| 786 | + const.STATE_MEASURE_ANGLE, | ||
| 787 | + const.STATE_ANNOTATE] | ||
| 786 | self.__init_items() | 788 | self.__init_items() |
| 787 | self.__bind_events() | 789 | self.__bind_events() |
| 788 | self.__bind_events_wx() | 790 | self.__bind_events_wx() |
| @@ -825,6 +827,16 @@ class ObjectToolBar(wx.ToolBar): | @@ -825,6 +827,16 @@ class ObjectToolBar(wx.ToolBar): | ||
| 825 | 827 | ||
| 826 | path = os.path.join(d, "tool_contrast_original.png") | 828 | path = os.path.join(d, "tool_contrast_original.png") |
| 827 | BMP_CONTRAST = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | 829 | BMP_CONTRAST = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) |
| 830 | + | ||
| 831 | + path = os.path.join(d, "measure_line_original.png") | ||
| 832 | + BMP_DISTANCE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | ||
| 833 | + | ||
| 834 | + path = os.path.join(d, "measure_angle_original.png") | ||
| 835 | + BMP_ANGLE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | ||
| 836 | + | ||
| 837 | + path = os.path.join(d, "tool_annotation_original.png") | ||
| 838 | + BMP_ANNOTATE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | ||
| 839 | + | ||
| 828 | else: | 840 | else: |
| 829 | path = os.path.join(d, "tool_rotate.gif") | 841 | path = os.path.join(d, "tool_rotate.gif") |
| 830 | BMP_ROTATE = wx.Bitmap(path, wx.BITMAP_TYPE_GIF) | 842 | BMP_ROTATE = wx.Bitmap(path, wx.BITMAP_TYPE_GIF) |
| @@ -841,6 +853,15 @@ class ObjectToolBar(wx.ToolBar): | @@ -841,6 +853,15 @@ class ObjectToolBar(wx.ToolBar): | ||
| 841 | path = os.path.join(d, "tool_contrast.png") | 853 | path = os.path.join(d, "tool_contrast.png") |
| 842 | BMP_CONTRAST = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | 854 | BMP_CONTRAST = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) |
| 843 | 855 | ||
| 856 | + path = os.path.join(d, "measure_line.png") | ||
| 857 | + BMP_DISTANCE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | ||
| 858 | + | ||
| 859 | + path = os.path.join(d, "measure_angle.jpg") | ||
| 860 | + BMP_ANGLE = wx.Bitmap(path, wx.BITMAP_TYPE_JPEG) | ||
| 861 | + | ||
| 862 | + path = os.path.join(d, "tool_annotation.png") | ||
| 863 | + BMP_ANNOTATE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | ||
| 864 | + | ||
| 844 | # Create tool items based on bitmaps | 865 | # Create tool items based on bitmaps |
| 845 | self.AddLabelTool(const.STATE_ZOOM, | 866 | self.AddLabelTool(const.STATE_ZOOM, |
| 846 | "", | 867 | "", |
| @@ -867,6 +888,21 @@ class ObjectToolBar(wx.ToolBar): | @@ -867,6 +888,21 @@ class ObjectToolBar(wx.ToolBar): | ||
| 867 | shortHelp = _("Constrast"), | 888 | shortHelp = _("Constrast"), |
| 868 | bitmap = BMP_CONTRAST, | 889 | bitmap = BMP_CONTRAST, |
| 869 | kind = wx.ITEM_CHECK) | 890 | kind = wx.ITEM_CHECK) |
| 891 | + self.AddLabelTool(const.STATE_MEASURE_DISTANCE, | ||
| 892 | + "", | ||
| 893 | + shortHelp = _("Measure distance"), | ||
| 894 | + bitmap = BMP_DISTANCE, | ||
| 895 | + kind = wx.ITEM_CHECK) | ||
| 896 | + self.AddLabelTool(const.STATE_MEASURE_ANGLE, | ||
| 897 | + "", | ||
| 898 | + shortHelp = _("Measure angle"), | ||
| 899 | + bitmap = BMP_ANGLE, | ||
| 900 | + kind = wx.ITEM_CHECK) | ||
| 901 | + self.AddLabelTool(const.STATE_ANNOTATE, | ||
| 902 | + "", | ||
| 903 | + shortHelp = _("Add annotation"), | ||
| 904 | + bitmap = BMP_ANNOTATE, | ||
| 905 | + kind = wx.ITEM_CHECK) | ||
| 870 | 906 | ||
| 871 | def _EnableState(self, pubsub_evt): | 907 | def _EnableState(self, pubsub_evt): |
| 872 | """ | 908 | """ |