Esempio n. 1
0
  def __init__(self, parent, id, title, phil=None, prefix='prime'):
    wx.Frame.__init__(self, parent, id, title, size=(800, 500))

    self.prime_filename = '{}.phil'.format(prefix)

    # Toolbar
    self.toolbar = self.CreateToolBar(wx.TB_TEXT)
    quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
    self.tb_btn_quit = self.toolbar.AddLabelTool(wx.ID_EXIT, label='Quit',
                                                 bitmap=quit_bmp,
                                                 shortHelp='Quit',
                                                 longHelp='Exit PRIME')
    pref_bmp = bitmaps.fetch_icon_bitmap('apps', 'advancedsettings')
    self.tb_btn_prefs = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                  label='Preferences',
                                                  bitmap=pref_bmp,
                                                  shortHelp='Preferences',
                                                  longHelp='PRIME Preferences')
    self.toolbar.AddSeparator()
    load_bmp = bitmaps.fetch_icon_bitmap('actions', 'open')
    self.tb_btn_load = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                 label='Load Script',
                                                 bitmap=load_bmp,
                                                 shortHelp='Load Script',
                                                 longHelp='Load PRIME Script')
    save_bmp = bitmaps.fetch_icon_bitmap('actions', 'save')
    self.tb_btn_save = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                 label='Save Script',
                                                 bitmap=save_bmp,
                                                 shortHelp='Save Script',
                                                 longHelp='Save PRIME Script')
    reset_bmp = bitmaps.fetch_icon_bitmap('actions', 'reload')
    self.tb_btn_reset = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                  label='Reset',
                                                  bitmap=reset_bmp,
                                                  shortHelp='Reset Settings',
                                                  longHelp='Reset PRIME settings with defaults')
    self.toolbar.AddSeparator()
    analyze_bmp = bitmaps.fetch_icon_bitmap('mimetypes', 'text-x-generic-2')
    self.tb_btn_analysis = self.toolbar.AddLabelTool(wx.ID_ANY, label='Recover',
                                                     bitmap=analyze_bmp,
                                                     shortHelp='Recover',
                                                     longHelp='Show past results')
    run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
    self.tb_btn_run = self.toolbar.AddLabelTool(wx.ID_ANY, label='Run',
                                                bitmap=run_bmp,
                                                shortHelp='Run',
                                                longHelp='Run scaling, merging and post-refinement with PRIME')
    # These buttons will be disabled until input path is provided
    self.toolbar.EnableTool(self.tb_btn_run.GetId(), False)
    self.toolbar.Realize()

    # Status bar
    self.sb = self.CreateStatusBar()
    self.sb.SetFieldsCount(3)
    self.sb.SetStatusWidths([320, 200, -2])

    # Menu bar
    menubar = wx.MenuBar()
    m_help = wx.Menu()
    m_file = wx.Menu()
    self.mb_load_script = m_file.Append(wx.ID_OPEN, '&Load Script...')
    self.mb_save_script = m_file.Append(wx.ID_SAVE, '&Save Script...')
    self.mb_about = m_help.Append(wx.ID_ANY, '&About')
    menubar.Append(m_file, '&File')
    menubar.Append(m_help, '&Help')
    self.SetMenuBar(menubar)

    # Place elements in main PRIME window
    main_box = wx.BoxSizer(wx.VERTICAL)

    # Instantiate windows
    self.input_window = frm.PRIMEInputWindow(self, phil=phil)

    # Single input window
    main_box.Add(self.input_window, 1, flag=wx.ALL | wx.EXPAND, border=10)
    main_box.Add((-1, 20))

    # Menubar button bindings
    self.Bind(wx.EVT_MENU, self.OnAboutBox, self.mb_about)
    self.Bind(wx.EVT_MENU, self.onSaveScript, self.mb_save_script)
    self.Bind(wx.EVT_MENU, self.onLoadScript, self.mb_load_script)

    # Toolbar button bindings
    self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
    self.Bind(wx.EVT_TOOL, self.onPreferences, self.tb_btn_prefs)
    self.Bind(wx.EVT_TOOL, self.onRecovery, self.tb_btn_analysis)
    self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_run)
    self.Bind(wx.EVT_TOOL, self.onLoadScript, self.tb_btn_load)
    self.Bind(wx.EVT_TOOL, self.onSaveScript, self.tb_btn_save)
    self.Bind(wx.EVT_TOOL, self.onReset, self.tb_btn_reset)

    # Draw the main window sizer
    self.SetSizer(main_box)
Esempio n. 2
0
    def __init__(self, parent, id, title, prefix='prime'):
        IOTABaseFrame.__init__(self, parent, id, title, size=(800, 500))

        self.prime_filename = '{}.phil'.format(prefix)
        self.prime_phil = master_phil

        # Toolbar
        self.initialize_toolbar()
        self.tb_btn_quit = self.add_tool(label='Quit',
                                         bitmap=('actions', 'exit'),
                                         shortHelp='Exit PRIME')

        self.tb_btn_prefs = self.add_tool(label='Preferences',
                                          bitmap=('apps', 'advancedsettings'),
                                          shortHelp='PRIME GUI Settings')
        self.add_toolbar_separator()
        self.tb_btn_load = self.add_tool(label='Load Script',
                                         bitmap=('actions', 'open'),
                                         shortHelp='Load PRIME Script')
        self.tb_btn_save = self.add_tool(label='Save Script',
                                         bitmap=('actions', 'save'),
                                         shortHelp='Save PRIME Script')
        self.tb_btn_reset = self.add_tool(label='Reset',
                                          bitmap=('actions', 'reload'),
                                          shortHelp='Reset Settings')
        self.toolbar.AddSeparator()
        self.tb_btn_analysis = self.add_tool(label='Recover',
                                             bitmap=('mimetypes',
                                                     'text-x-generic-2'),
                                             shortHelp='Recover PRIME run')
        self.tb_btn_run = self.add_tool(label='Run',
                                        bitmap=('actions', 'run'),
                                        shortHelp='Run PRIME')
        # These buttons will be disabled until input path is provided
        self.set_tool_state(self.tb_btn_run, enable=False)
        self.realize_toolbar()

        # Status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(3)
        self.sb.SetStatusWidths([320, 200, -2])

        # Menu bar
        menubar = wx.MenuBar()
        m_help = wx.Menu()
        m_file = wx.Menu()
        self.mb_load_script = m_file.Append(wx.ID_OPEN, '&Load Script...')
        self.mb_save_script = m_file.Append(wx.ID_SAVE, '&Save Script...')
        self.mb_about = m_help.Append(wx.ID_ANY, '&About')
        menubar.Append(m_file, '&File')
        menubar.Append(m_help, '&Help')
        self.SetMenuBar(menubar)

        # Place elements in main PRIME window
        main_box = wx.BoxSizer(wx.VERTICAL)

        # Instantiate windows
        self.input_window = frm.PRIMEInputWindow(self, phil=self.prime_phil)

        # Single input window
        main_box.Add(self.input_window, 1, flag=wx.ALL | wx.EXPAND, border=10)
        main_box.Add((-1, 20))

        # Menubar button bindings
        self.Bind(wx.EVT_MENU, self.OnAboutBox, self.mb_about)
        self.Bind(wx.EVT_MENU, self.onSaveScript, self.mb_save_script)
        self.Bind(wx.EVT_MENU, self.onLoadScript, self.mb_load_script)

        # Toolbar button bindings
        self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
        self.Bind(wx.EVT_TOOL, self.onPreferences, self.tb_btn_prefs)
        self.Bind(wx.EVT_TOOL, self.onRecovery, self.tb_btn_analysis)
        self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_run)
        self.Bind(wx.EVT_TOOL, self.onLoadScript, self.tb_btn_load)
        self.Bind(wx.EVT_TOOL, self.onSaveScript, self.tb_btn_save)
        self.Bind(wx.EVT_TOOL, self.onReset, self.tb_btn_reset)

        # Input window bindings
        self.Bind(wx.EVT_BUTTON, self.onAdvancedOptions,
                  self.input_window.opt_btn)

        # Draw the main window sizer
        self.SetSizer(main_box)