Commit 58dbfb0ef9e67335aeb8323f68c53166fd2d3392
1 parent
f6c43378
Exists in
master
and in
2 other branches
Convert toolbar from wx.ToolBar to AuiToolbar.
It was necessary to change from wx.toolbar to auitoolbar because in macosx it is not possible to untoggle a toggle button when using a wx.toobar inside a aui. Some tests to make toolbar toggle work in mac Added more toolbars as auitoolbar A Refresh after untoggle all A Refresh after untoggle all Converted LayoutToolbar to auitoolbar Converted HistoryToolbar to auitoolbar Converted ProjectToolbat to auitoolbar deleted mask icon changed the style of toolbar to not use gradient
Showing
3 changed files
with
128 additions
and
80 deletions
Show diff stats
icons/mask.png
2.63 KB
icons/mask_small.png
791 Bytes
invesalius/gui/frame.py
... | ... | @@ -29,6 +29,8 @@ from wx.lib.pubsub import pub as Publisher |
29 | 29 | import wx.lib.agw.toasterbox as TB |
30 | 30 | import wx.lib.popupctl as pc |
31 | 31 | |
32 | +from wx.lib.agw.aui.auibar import AuiToolBar, AUI_TB_PLAIN_BACKGROUND | |
33 | + | |
32 | 34 | import constants as const |
33 | 35 | import default_tasks as tasks |
34 | 36 | import default_viewers as viewers |
... | ... | @@ -194,6 +196,7 @@ class Frame(wx.Frame): |
194 | 196 | t2 = ObjectToolBar(self) |
195 | 197 | t1 = SliceToolBar(self) |
196 | 198 | |
199 | + | |
197 | 200 | aui_manager.AddPane(t1, wx.aui.AuiPaneInfo(). |
198 | 201 | Name("General Features Toolbar"). |
199 | 202 | ToolbarPane().Top().Floatable(False). |
... | ... | @@ -878,16 +881,16 @@ class TaskBarIcon(wx.TaskBarIcon): |
878 | 881 | # ------------------------------------------------------------------ |
879 | 882 | # ------------------------------------------------------------------ |
880 | 883 | |
881 | -class ProjectToolBar(wx.ToolBar): | |
884 | +class ProjectToolBar(AuiToolBar): | |
882 | 885 | """ |
883 | 886 | Toolbar related to general project operations, including: import, |
884 | 887 | open, save and saveas, among others. |
885 | 888 | """ |
886 | 889 | def __init__(self, parent): |
887 | - style = wx.TB_FLAT|wx.TB_NODIVIDER| wx.TB_DOCKABLE | |
888 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
890 | + style = AUI_TB_PLAIN_BACKGROUND | |
891 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
889 | 892 | wx.DefaultSize, |
890 | - style) | |
893 | + agwStyle=style) | |
891 | 894 | self.SetToolBitmapSize(wx.Size(32,32)) |
892 | 895 | |
893 | 896 | self.parent = parent |
... | ... | @@ -953,21 +956,27 @@ class ProjectToolBar(wx.ToolBar): |
953 | 956 | BMP_PHOTO = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) |
954 | 957 | |
955 | 958 | # Create tool items based on bitmaps |
956 | - self.AddLabelTool(const.ID_DICOM_IMPORT, | |
959 | + self.AddTool(const.ID_DICOM_IMPORT, | |
957 | 960 | "", |
958 | - shortHelp =_("Import DICOM files...\tCtrl+I"), | |
959 | - bitmap=BMP_IMPORT) | |
961 | + BMP_IMPORT, | |
962 | + wx.NullBitmap, | |
963 | + wx.ITEM_NORMAL, | |
964 | + short_help_string =_("Import DICOM files...\tCtrl+I")) | |
960 | 965 | #self.AddLabelTool(const.ID_DICOM_LOAD_NET, |
961 | 966 | # "Load medical image...", |
962 | 967 | # BMP_NET) |
963 | - self.AddLabelTool(const.ID_PROJECT_OPEN, | |
968 | + self.AddTool(const.ID_PROJECT_OPEN, | |
964 | 969 | "", |
965 | - shortHelp =_("Open InVesalius project..."), | |
966 | - bitmap=BMP_OPEN) | |
967 | - self.AddLabelTool(const.ID_PROJECT_SAVE, | |
970 | + BMP_OPEN, | |
971 | + wx.NullBitmap, | |
972 | + wx.ITEM_NORMAL, | |
973 | + short_help_string =_("Open InVesalius project...")) | |
974 | + self.AddTool(const.ID_PROJECT_SAVE, | |
968 | 975 | "", |
969 | - shortHelp = _("Save InVesalius project"), | |
970 | - bitmap=BMP_SAVE) | |
976 | + BMP_SAVE, | |
977 | + wx.NullBitmap, | |
978 | + wx.ITEM_NORMAL, | |
979 | + short_help_string = _("Save InVesalius project")) | |
971 | 980 | #self.AddLabelTool(const.ID_SAVE_SCREENSHOT, |
972 | 981 | # "Take photo of screen", |
973 | 982 | # BMP_PHOTO) |
... | ... | @@ -985,6 +994,7 @@ class ProjectToolBar(wx.ToolBar): |
985 | 994 | self.SetStateProjectOpen() |
986 | 995 | else: |
987 | 996 | self.SetStateProjectClose() |
997 | + self.Refresh() | |
988 | 998 | |
989 | 999 | def SetStateProjectClose(self): |
990 | 1000 | """ |
... | ... | @@ -992,6 +1002,7 @@ class ProjectToolBar(wx.ToolBar): |
992 | 1002 | """ |
993 | 1003 | for tool in self.enable_items: |
994 | 1004 | self.EnableTool(tool, False) |
1005 | + self.Refresh() | |
995 | 1006 | |
996 | 1007 | def SetStateProjectOpen(self): |
997 | 1008 | """ |
... | ... | @@ -999,6 +1010,7 @@ class ProjectToolBar(wx.ToolBar): |
999 | 1010 | """ |
1000 | 1011 | for tool in self.enable_items: |
1001 | 1012 | self.EnableTool(tool, True) |
1013 | + self.Refresh() | |
1002 | 1014 | |
1003 | 1015 | |
1004 | 1016 | |
... | ... | @@ -1006,15 +1018,15 @@ class ProjectToolBar(wx.ToolBar): |
1006 | 1018 | # ------------------------------------------------------------------ |
1007 | 1019 | # ------------------------------------------------------------------ |
1008 | 1020 | |
1009 | -class ObjectToolBar(wx.ToolBar): | |
1021 | +class ObjectToolBar(AuiToolBar): | |
1010 | 1022 | """ |
1011 | 1023 | Toolbar related to general object operations, including: zoom |
1012 | 1024 | move, rotate, brightness/contrast, etc. |
1013 | 1025 | """ |
1014 | 1026 | def __init__(self, parent): |
1015 | - style = wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE | |
1016 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1017 | - wx.DefaultSize, style) | |
1027 | + style = AUI_TB_PLAIN_BACKGROUND | |
1028 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1029 | + wx.DefaultSize, agwStyle=style) | |
1018 | 1030 | |
1019 | 1031 | self.SetToolBitmapSize(wx.Size(32,32)) |
1020 | 1032 | |
... | ... | @@ -1106,40 +1118,47 @@ class ObjectToolBar(wx.ToolBar): |
1106 | 1118 | #BMP_ANNOTATE = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) |
1107 | 1119 | |
1108 | 1120 | # Create tool items based on bitmaps |
1109 | - self.AddLabelTool(const.STATE_ZOOM, | |
1121 | + self.AddTool(const.STATE_ZOOM, | |
1110 | 1122 | "", |
1111 | - shortHelp =_("Zoom"), | |
1112 | - bitmap=BMP_ZOOM, | |
1123 | + BMP_ZOOM, | |
1124 | + wx.NullBitmap, | |
1125 | + short_help_string =_("Zoom"), | |
1113 | 1126 | kind = wx.ITEM_CHECK) |
1114 | - self.AddLabelTool(const.STATE_ZOOM_SL, | |
1127 | + self.AddTool(const.STATE_ZOOM_SL, | |
1115 | 1128 | "", |
1116 | - shortHelp = _("Zoom based on selection"), | |
1117 | - bitmap = BMP_ZOOM_SELECT, | |
1129 | + BMP_ZOOM_SELECT, | |
1130 | + wx.NullBitmap, | |
1131 | + short_help_string = _("Zoom based on selection"), | |
1118 | 1132 | kind = wx.ITEM_CHECK) |
1119 | - self.AddLabelTool(const.STATE_SPIN, | |
1133 | + self.AddTool(const.STATE_SPIN, | |
1120 | 1134 | "", |
1121 | - shortHelp = _("Rotate"), | |
1122 | - bitmap = BMP_ROTATE, | |
1135 | + BMP_ROTATE, | |
1136 | + wx.NullBitmap, | |
1137 | + short_help_string = _("Rotate"), | |
1123 | 1138 | kind = wx.ITEM_CHECK) |
1124 | - self.AddLabelTool(const.STATE_PAN, | |
1139 | + self.AddTool(const.STATE_PAN, | |
1125 | 1140 | "", |
1126 | - shortHelp = _("Move"), | |
1127 | - bitmap = BMP_MOVE, | |
1141 | + BMP_MOVE, | |
1142 | + wx.NullBitmap, | |
1143 | + short_help_string = _("Move"), | |
1128 | 1144 | kind = wx.ITEM_CHECK) |
1129 | - self.AddLabelTool(const.STATE_WL, | |
1145 | + self.AddTool(const.STATE_WL, | |
1130 | 1146 | "", |
1131 | - shortHelp = _("Constrast"), | |
1132 | - bitmap = BMP_CONTRAST, | |
1147 | + BMP_CONTRAST, | |
1148 | + wx.NullBitmap, | |
1149 | + short_help_string = _("Constrast"), | |
1133 | 1150 | kind = wx.ITEM_CHECK) |
1134 | - self.AddLabelTool(const.STATE_MEASURE_DISTANCE, | |
1151 | + self.AddTool(const.STATE_MEASURE_DISTANCE, | |
1135 | 1152 | "", |
1136 | - shortHelp = _("Measure distance"), | |
1137 | - bitmap = BMP_DISTANCE, | |
1153 | + BMP_DISTANCE, | |
1154 | + wx.NullBitmap, | |
1155 | + short_help_string = _("Measure distance"), | |
1138 | 1156 | kind = wx.ITEM_CHECK) |
1139 | - self.AddLabelTool(const.STATE_MEASURE_ANGLE, | |
1157 | + self.AddTool(const.STATE_MEASURE_ANGLE, | |
1140 | 1158 | "", |
1141 | - shortHelp = _("Measure angle"), | |
1142 | - bitmap = BMP_ANGLE, | |
1159 | + BMP_ANGLE, | |
1160 | + wx.NullBitmap, | |
1161 | + short_help_string = _("Measure angle"), | |
1143 | 1162 | kind = wx.ITEM_CHECK) |
1144 | 1163 | #self.AddLabelTool(const.STATE_ANNOTATE, |
1145 | 1164 | # "", |
... | ... | @@ -1157,15 +1176,17 @@ class ObjectToolBar(wx.ToolBar): |
1157 | 1176 | self.SetStateProjectOpen() |
1158 | 1177 | else: |
1159 | 1178 | self.SetStateProjectClose() |
1179 | + self.Refresh() | |
1160 | 1180 | |
1161 | 1181 | def _UntoggleAllItems(self, pubsub_evt=None): |
1162 | 1182 | """ |
1163 | 1183 | Untoggle all items on toolbar. |
1164 | 1184 | """ |
1165 | 1185 | for id in const.TOOL_STATES: |
1166 | - state = self.GetToolState(id) | |
1186 | + state = self.GetToolToggled(id) | |
1167 | 1187 | if state: |
1168 | 1188 | self.ToggleTool(id, False) |
1189 | + self.Refresh() | |
1169 | 1190 | |
1170 | 1191 | def _ToggleLinearMeasure(self, pubsub_evt): |
1171 | 1192 | """ |
... | ... | @@ -1177,7 +1198,7 @@ class ObjectToolBar(wx.ToolBar): |
1177 | 1198 | Publisher.sendMessage('Enable style', id) |
1178 | 1199 | Publisher.sendMessage('Untoggle slice toolbar items') |
1179 | 1200 | for item in const.TOOL_STATES: |
1180 | - state = self.GetToolState(item) | |
1201 | + state = self.GetToolToggled(item) | |
1181 | 1202 | if state and (item != id): |
1182 | 1203 | self.ToggleTool(item, False) |
1183 | 1204 | |
... | ... | @@ -1192,7 +1213,7 @@ class ObjectToolBar(wx.ToolBar): |
1192 | 1213 | Publisher.sendMessage('Enable style', id) |
1193 | 1214 | Publisher.sendMessage('Untoggle slice toolbar items') |
1194 | 1215 | for item in const.TOOL_STATES: |
1195 | - state = self.GetToolState(item) | |
1216 | + state = self.GetToolToggled(item) | |
1196 | 1217 | if state and (item != id): |
1197 | 1218 | self.ToggleTool(item, False) |
1198 | 1219 | |
... | ... | @@ -1202,7 +1223,7 @@ class ObjectToolBar(wx.ToolBar): |
1202 | 1223 | should be toggle each time). |
1203 | 1224 | """ |
1204 | 1225 | id = evt.GetId() |
1205 | - state = self.GetToolState(id) | |
1226 | + state = self.GetToolToggled(id) | |
1206 | 1227 | if state and ((id == const.STATE_MEASURE_DISTANCE) or\ |
1207 | 1228 | (id == const.STATE_MEASURE_ANGLE)): |
1208 | 1229 | Publisher.sendMessage('Fold measure task') |
... | ... | @@ -1214,7 +1235,7 @@ class ObjectToolBar(wx.ToolBar): |
1214 | 1235 | Publisher.sendMessage('Disable style', id) |
1215 | 1236 | |
1216 | 1237 | for item in const.TOOL_STATES: |
1217 | - state = self.GetToolState(item) | |
1238 | + state = self.GetToolToggled(item) | |
1218 | 1239 | if state and (item != id): |
1219 | 1240 | self.ToggleTool(item, False) |
1220 | 1241 | evt.Skip() |
... | ... | @@ -1238,16 +1259,16 @@ class ObjectToolBar(wx.ToolBar): |
1238 | 1259 | # ------------------------------------------------------------------ |
1239 | 1260 | # ------------------------------------------------------------------ |
1240 | 1261 | |
1241 | -class SliceToolBar(wx.ToolBar): | |
1262 | +class SliceToolBar(AuiToolBar): | |
1242 | 1263 | """ |
1243 | 1264 | Toolbar related to 2D slice specific operations, including: cross |
1244 | 1265 | intersection reference and scroll slices. |
1245 | 1266 | """ |
1246 | 1267 | def __init__(self, parent): |
1247 | - style = wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE | |
1248 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1268 | + style = AUI_TB_PLAIN_BACKGROUND | |
1269 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1249 | 1270 | wx.DefaultSize, |
1250 | - style) | |
1271 | + agwStyle=style) | |
1251 | 1272 | |
1252 | 1273 | self.SetToolBitmapSize(wx.Size(32,32)) |
1253 | 1274 | |
... | ... | @@ -1279,13 +1300,17 @@ class SliceToolBar(wx.ToolBar): |
1279 | 1300 | path = os.path.join(d,"cross.png") |
1280 | 1301 | BMP_CROSS = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) |
1281 | 1302 | |
1282 | - self.AddCheckTool(const.SLICE_STATE_SCROLL, | |
1283 | - BMP_SLICE, | |
1284 | - shortHelp = _("Scroll slices")) | |
1303 | + self.sst = self.AddToggleTool(const.SLICE_STATE_SCROLL, | |
1304 | + BMP_SLICE,#, kind=wx.ITEM_CHECK) | |
1305 | + wx.NullBitmap, | |
1306 | + toggle=True, | |
1307 | + short_help_string=_("Scroll slices")) | |
1285 | 1308 | |
1286 | - self.AddCheckTool(const.SLICE_STATE_CROSS, | |
1287 | - BMP_CROSS, | |
1288 | - shortHelp = _("Slices' cross intersection")) | |
1309 | + self.sct = self.AddToggleTool(const.SLICE_STATE_CROSS, | |
1310 | + BMP_CROSS,#, kind=wx.ITEM_CHECK) | |
1311 | + wx.NullBitmap, | |
1312 | + toggle=True, | |
1313 | + short_help_string=_("Slices' cross intersection")) | |
1289 | 1314 | |
1290 | 1315 | def __bind_events(self): |
1291 | 1316 | """ |
... | ... | @@ -1312,18 +1337,20 @@ class SliceToolBar(wx.ToolBar): |
1312 | 1337 | else: |
1313 | 1338 | self.SetStateProjectClose() |
1314 | 1339 | self._UntoggleAllItems() |
1340 | + self.Refresh() | |
1315 | 1341 | |
1316 | 1342 | def _UntoggleAllItems(self, pubsub_evt=None): |
1317 | 1343 | """ |
1318 | 1344 | Untoggle all items on toolbar. |
1319 | 1345 | """ |
1320 | 1346 | for id in const.TOOL_SLICE_STATES: |
1321 | - state = self.GetToolState(id) | |
1347 | + state = self.GetToolToggled(id) | |
1322 | 1348 | if state: |
1323 | 1349 | self.ToggleTool(id, False) |
1324 | 1350 | if id == const.SLICE_STATE_CROSS: |
1325 | 1351 | msg = 'Set cross visibility' |
1326 | 1352 | Publisher.sendMessage(msg, 0) |
1353 | + self.Refresh() | |
1327 | 1354 | |
1328 | 1355 | def OnToggle(self, evt): |
1329 | 1356 | """ |
... | ... | @@ -1331,7 +1358,9 @@ class SliceToolBar(wx.ToolBar): |
1331 | 1358 | should be toggle each time). |
1332 | 1359 | """ |
1333 | 1360 | id = evt.GetId() |
1334 | - state = self.GetToolState(id) | |
1361 | + evt.Skip() | |
1362 | + | |
1363 | + state = self.GetToolToggled(id) | |
1335 | 1364 | |
1336 | 1365 | if state: |
1337 | 1366 | Publisher.sendMessage('Enable style', id) |
... | ... | @@ -1339,12 +1368,17 @@ class SliceToolBar(wx.ToolBar): |
1339 | 1368 | else: |
1340 | 1369 | Publisher.sendMessage('Disable style', id) |
1341 | 1370 | |
1342 | - for item in const.TOOL_SLICE_STATES: | |
1343 | - state = self.GetToolState(item) | |
1371 | + for item in self.enable_items: | |
1372 | + state = self.GetToolToggled(item) | |
1344 | 1373 | if state and (item != id): |
1374 | + print ">>>>", item | |
1345 | 1375 | self.ToggleTool(item, False) |
1376 | + #self.ToggleTool(const.SLICE_STATE_SCROLL, self.GetToolToggled(const.SLICE_STATE_CROSS)) | |
1377 | + #self.Update() | |
1378 | + ##self.sst.SetToggle(self.sct.IsToggled()) | |
1379 | + ##print ">>>", self.sst.IsToggled() | |
1380 | + #print ">>>", self.sst.GetState() | |
1346 | 1381 | |
1347 | - evt.Skip() | |
1348 | 1382 | |
1349 | 1383 | def SetStateProjectClose(self): |
1350 | 1384 | """ |
... | ... | @@ -1352,6 +1386,7 @@ class SliceToolBar(wx.ToolBar): |
1352 | 1386 | """ |
1353 | 1387 | for tool in self.enable_items: |
1354 | 1388 | self.EnableTool(tool, False) |
1389 | + self.Refresh() | |
1355 | 1390 | |
1356 | 1391 | def SetStateProjectOpen(self): |
1357 | 1392 | """ |
... | ... | @@ -1359,21 +1394,22 @@ class SliceToolBar(wx.ToolBar): |
1359 | 1394 | """ |
1360 | 1395 | for tool in self.enable_items: |
1361 | 1396 | self.EnableTool(tool, True) |
1397 | + self.Refresh() | |
1362 | 1398 | |
1363 | 1399 | # ------------------------------------------------------------------ |
1364 | 1400 | # ------------------------------------------------------------------ |
1365 | 1401 | # ------------------------------------------------------------------ |
1366 | 1402 | |
1367 | -class LayoutToolBar(wx.ToolBar): | |
1403 | +class LayoutToolBar(AuiToolBar): | |
1368 | 1404 | """ |
1369 | 1405 | Toolbar related to general layout/ visualization configuration |
1370 | 1406 | e.g: show/hide task panel and show/hide text on viewers. |
1371 | 1407 | """ |
1372 | 1408 | def __init__(self, parent): |
1373 | - style = wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE | |
1374 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1409 | + style = AUI_TB_PLAIN_BACKGROUND | |
1410 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1375 | 1411 | wx.DefaultSize, |
1376 | - style) | |
1412 | + agwStyle=style) | |
1377 | 1413 | |
1378 | 1414 | self.SetToolBitmapSize(wx.Size(32,32)) |
1379 | 1415 | |
... | ... | @@ -1439,14 +1475,18 @@ class LayoutToolBar(wx.ToolBar): |
1439 | 1475 | p = os.path.join(d, "text.png") |
1440 | 1476 | self.BMP_WITH_TEXT = wx.Bitmap(p, wx.BITMAP_TYPE_PNG) |
1441 | 1477 | |
1442 | - self.AddLabelTool(ID_LAYOUT, | |
1478 | + self.AddTool(ID_LAYOUT, | |
1443 | 1479 | "", |
1444 | - bitmap=self.BMP_WITHOUT_MENU, | |
1445 | - shortHelp= _("Hide task panel")) | |
1446 | - self.AddLabelTool(ID_TEXT, | |
1480 | + self.BMP_WITHOUT_MENU, | |
1481 | + wx.NullBitmap, | |
1482 | + wx.ITEM_NORMAL, | |
1483 | + short_help_string= _("Hide task panel")) | |
1484 | + self.AddTool(ID_TEXT, | |
1447 | 1485 | "", |
1448 | - bitmap=self.BMP_WITH_TEXT, | |
1449 | - shortHelp= _("Hide text")) | |
1486 | + self.BMP_WITH_TEXT, | |
1487 | + wx.NullBitmap, | |
1488 | + wx.ITEM_NORMAL, | |
1489 | + short_help_string= _("Hide text")) | |
1450 | 1490 | |
1451 | 1491 | def _EnableState(self, pubsub_evt): |
1452 | 1492 | """ |
... | ... | @@ -1458,6 +1498,7 @@ class LayoutToolBar(wx.ToolBar): |
1458 | 1498 | self.SetStateProjectOpen() |
1459 | 1499 | else: |
1460 | 1500 | self.SetStateProjectClose() |
1501 | + self.Refresh() | |
1461 | 1502 | |
1462 | 1503 | def _SetLayoutWithoutTask(self, pubsub_evt): |
1463 | 1504 | """ |
... | ... | @@ -1482,7 +1523,7 @@ class LayoutToolBar(wx.ToolBar): |
1482 | 1523 | self.ToggleText() |
1483 | 1524 | |
1484 | 1525 | for item in VIEW_TOOLS: |
1485 | - state = self.GetToolState(item) | |
1526 | + state = self.GetToolToggled(item) | |
1486 | 1527 | if state and (item != id): |
1487 | 1528 | self.ToggleTool(item, False) |
1488 | 1529 | |
... | ... | @@ -1538,16 +1579,16 @@ class LayoutToolBar(wx.ToolBar): |
1538 | 1579 | self.ontool_text = True |
1539 | 1580 | |
1540 | 1581 | |
1541 | -class HistoryToolBar(wx.ToolBar): | |
1582 | +class HistoryToolBar(AuiToolBar): | |
1542 | 1583 | """ |
1543 | 1584 | Toolbar related to general layout/ visualization configuration |
1544 | 1585 | e.g: show/hide task panel and show/hide text on viewers. |
1545 | 1586 | """ |
1546 | 1587 | def __init__(self, parent): |
1547 | - style = wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE | |
1548 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1588 | + style = AUI_TB_PLAIN_BACKGROUND | |
1589 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1549 | 1590 | wx.DefaultSize, |
1550 | - style) | |
1591 | + agwStyle=style) | |
1551 | 1592 | |
1552 | 1593 | self.SetToolBitmapSize(wx.Size(32,32)) |
1553 | 1594 | |
... | ... | @@ -1603,15 +1644,19 @@ class HistoryToolBar(wx.ToolBar): |
1603 | 1644 | p = os.path.join(d, "redo_small.png") |
1604 | 1645 | self.BMP_REDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG) |
1605 | 1646 | |
1606 | - self.AddLabelTool(wx.ID_UNDO, | |
1647 | + self.AddTool(wx.ID_UNDO, | |
1607 | 1648 | "", |
1608 | - bitmap=self.BMP_UNDO, | |
1609 | - shortHelp= _("Undo")) | |
1649 | + self.BMP_UNDO, | |
1650 | + wx.NullBitmap, | |
1651 | + wx.ITEM_NORMAL, | |
1652 | + short_help_string= _("Undo")) | |
1610 | 1653 | |
1611 | - self.AddLabelTool(wx.ID_REDO, | |
1654 | + self.AddTool(wx.ID_REDO, | |
1612 | 1655 | "", |
1613 | - bitmap=self.BMP_REDO, | |
1614 | - shortHelp= _("Redo")) | |
1656 | + self.BMP_REDO, | |
1657 | + wx.NullBitmap, | |
1658 | + wx.ITEM_NORMAL, | |
1659 | + short_help_string=_("Redo")) | |
1615 | 1660 | |
1616 | 1661 | self.EnableTool(wx.ID_UNDO, False) |
1617 | 1662 | self.EnableTool(wx.ID_REDO, False) |
... | ... | @@ -1626,6 +1671,7 @@ class HistoryToolBar(wx.ToolBar): |
1626 | 1671 | self.SetStateProjectOpen() |
1627 | 1672 | else: |
1628 | 1673 | self.SetStateProjectClose() |
1674 | + self.Refresh() | |
1629 | 1675 | |
1630 | 1676 | def _SetLayoutWithoutTask(self, pubsub_evt): |
1631 | 1677 | """ |
... | ... | @@ -1658,7 +1704,7 @@ class HistoryToolBar(wx.ToolBar): |
1658 | 1704 | self.ToggleText() |
1659 | 1705 | |
1660 | 1706 | for item in VIEW_TOOLS: |
1661 | - state = self.GetToolState(item) | |
1707 | + state = self.GetToolToggled(item) | |
1662 | 1708 | if state and (item != id): |
1663 | 1709 | self.ToggleTool(item, False) |
1664 | 1710 | |
... | ... | @@ -1719,6 +1765,7 @@ class HistoryToolBar(wx.ToolBar): |
1719 | 1765 | self.EnableTool(wx.ID_UNDO, True) |
1720 | 1766 | else: |
1721 | 1767 | self.EnableTool(wx.ID_UNDO, False) |
1768 | + self.Refresh() | |
1722 | 1769 | |
1723 | 1770 | def OnEnableRedo(self, pubsub_evt): |
1724 | 1771 | value = pubsub_evt.data |
... | ... | @@ -1726,3 +1773,4 @@ class HistoryToolBar(wx.ToolBar): |
1726 | 1773 | self.EnableTool(wx.ID_REDO, True) |
1727 | 1774 | else: |
1728 | 1775 | self.EnableTool(wx.ID_REDO, False) |
1776 | + self.Refresh() | ... | ... |