[959eb01] | 1 | |
---|
| 2 | """ |
---|
| 3 | Provide the style for guiframe |
---|
| 4 | """ |
---|
[a1b8fee] | 5 | from __future__ import print_function |
---|
| 6 | |
---|
[959eb01] | 7 | import wx |
---|
| 8 | import os |
---|
| 9 | from sas.sasgui.guiframe import get_data_path |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | class GUIFRAME: |
---|
| 13 | MANAGER_ON = 1 |
---|
| 14 | FLOATING_PANEL = 2 |
---|
| 15 | FIXED_PANEL = 4 |
---|
| 16 | PLOTTING_ON = 8 |
---|
| 17 | DATALOADER_ON = 16 |
---|
| 18 | TOOLBAR_ON = 32 |
---|
| 19 | CALCULATOR_ON = 256 |
---|
| 20 | SINGLE_APPLICATION = 64 |
---|
| 21 | WELCOME_PANEL_ON = 128 |
---|
| 22 | DEFAULT_STYLE = SINGLE_APPLICATION|DATALOADER_ON|PLOTTING_ON|FIXED_PANEL |
---|
| 23 | MULTIPLE_APPLICATIONS = DEFAULT_STYLE |
---|
| 24 | |
---|
| 25 | class GUIFRAME_ID: |
---|
| 26 | UNDO_ID = wx.NewId() |
---|
| 27 | REDO_ID = wx.NewId() |
---|
| 28 | COPY_ID = wx.NewId() |
---|
| 29 | PASTE_ID = wx.NewId() |
---|
| 30 | BOOKMARK_ID = wx.NewId() |
---|
| 31 | SAVE_ID = wx.NewId() |
---|
| 32 | ZOOM_IN_ID = wx.NewId() |
---|
| 33 | ZOOM_OUT_ID = wx.NewId() |
---|
| 34 | ZOOM_ID = wx.NewId() |
---|
| 35 | DRAG_ID = wx.NewId() |
---|
| 36 | RESET_ID = wx.NewId() |
---|
| 37 | PREVIEW_ID = wx.NewId() |
---|
| 38 | PRINT_ID = wx.NewId() |
---|
| 39 | CURRENT_APPLICATION = wx.NewId() |
---|
| 40 | CURVE_SYMBOL_NUM = 13 |
---|
| 41 | COPYEX_ID = wx.NewId() |
---|
| 42 | COPYLAT_ID = wx.NewId() |
---|
| 43 | COPYAS_ID = wx.NewId() |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | class GUIFRAME_ICON: |
---|
| 47 | PATH = get_data_path(media='images') |
---|
| 48 | FRAME_ICON_PATH = os.path.join(PATH, 'ball.ico') |
---|
| 49 | SAVE_ICON_PATH = os.path.join(PATH, 'save.png') |
---|
| 50 | UNDO_ICON_PATH = os.path.join(PATH, 'undo.png') |
---|
| 51 | REDO_ICON_PATH = os.path.join(PATH, 'redo.png') |
---|
| 52 | COPY_ICON_PATH = os.path.join(PATH, 'copy.png') |
---|
| 53 | PASTE_ICON_PATH = os.path.join(PATH, 'paste.png') |
---|
| 54 | BOOKMARK_ICON_PATH = os.path.join(PATH, 'bookmark.png') |
---|
| 55 | ZOOM_IN_ID_PATH = os.path.join(PATH, 'zoom_in.png') |
---|
| 56 | ZOOM_OUT_ID_PATH = os.path.join(PATH, 'zoom_out.png') |
---|
| 57 | ZOOM_ID_PATH = os.path.join(PATH, 'search_pan.png') |
---|
| 58 | DRAG_ID_PATH = os.path.join(PATH, 'drag_hand.png') |
---|
| 59 | RESET_ID_PATH = os.path.join(PATH, 'reset.png') |
---|
[5251ec6] | 60 | REPORT_ID_PATH = os.path.join(PATH, 'report.png') |
---|
| 61 | PREVIEW_ID_PATH = os.path.join(PATH, 'preview.png') |
---|
[959eb01] | 62 | PRINT_ID_PATH = os.path.join(PATH, 'printer.png') |
---|
| 63 | HIDE_ID_PATH = os.path.join(PATH, 'hide.png') |
---|
| 64 | |
---|
[5251ec6] | 65 | # Note: wx 4 requires that the app be defined before |
---|
| 66 | # the images are loaded, so they can't be processed |
---|
| 67 | # at module load time. Instead, need to load icons |
---|
| 68 | # when the app is created. |
---|
| 69 | @classmethod |
---|
| 70 | def load_icons(cls): |
---|
| 71 | cls.SAVE_ICON = wx.Image(cls.SAVE_ICON_PATH) |
---|
| 72 | cls.UNDO_ICON = wx.Image(cls.UNDO_ICON_PATH) |
---|
| 73 | cls.REDO_ICON = wx.Image(cls.REDO_ICON_PATH) |
---|
| 74 | cls.COPY_ICON = wx.Image(cls.COPY_ICON_PATH) |
---|
| 75 | cls.PASTE_ICON = wx.Image(cls.PASTE_ICON_PATH) |
---|
| 76 | cls.BOOKMARK_ICON = wx.Image(cls.BOOKMARK_ICON_PATH) |
---|
| 77 | cls.ZOOM_IN_ICON = wx.Image(cls.ZOOM_IN_ID_PATH) |
---|
| 78 | cls.ZOOM_OUT_ICON = wx.Image(cls.ZOOM_OUT_ID_PATH) |
---|
| 79 | cls.ZOOM_ICON = wx.Image(cls.ZOOM_ID_PATH) |
---|
| 80 | cls.DRAG_ICON = wx.Image(cls.DRAG_ID_PATH) |
---|
| 81 | cls.RESET_ICON = wx.Image(cls.RESET_ID_PATH) |
---|
| 82 | cls.REPORT_ICON = wx.Image(cls.REPORT_ID_PATH) |
---|
| 83 | cls.PREVIEW_ICON = wx.Image(cls.PREVIEW_ID_PATH) |
---|
| 84 | cls.PRINT_ICON = wx.Image(cls.PRINT_ID_PATH) |
---|
| 85 | cls.HIDE_ICON = wx.Image(cls.HIDE_ID_PATH) |
---|
[959eb01] | 86 | |
---|
| 87 | if __name__ == "__main__": |
---|
| 88 | |
---|
[9c3d784] | 89 | print(GUIFRAME.DEFAULT_STYLE) |
---|
| 90 | print(GUIFRAME.FLOATING_PANEL) |
---|
| 91 | print(GUIFRAME.SINGLE_APPLICATION) |
---|
[959eb01] | 92 | style = GUIFRAME.MULTIPLE_APPLICATIONS |
---|
| 93 | style &= GUIFRAME.PLOTTING_ON |
---|
[9c3d784] | 94 | print(style == GUIFRAME.PLOTTING_ON) |
---|
[959eb01] | 95 | style1 = GUIFRAME.MULTIPLE_APPLICATIONS |
---|
| 96 | style1 &= (~GUIFRAME.MANAGER_ON) |
---|
[9c3d784] | 97 | print(style1 == GUIFRAME.DEFAULT_STYLE) |
---|
[5251ec6] | 98 | print(style1) |
---|