Пример #1
0
    def __init__(self, parent, filename=None, **kwargs):
        super(WfkViewerFrame, self).__init__(parent, -1, title=self.codename, **kwargs)

        self.statusbar = self.CreateStatusBar()

        menuBar = wx.MenuBar()

        file_menu = wx.Menu()
        file_menu.Append(wx.ID_OPEN, "&Open", help="Open an existing WFK file")
        file_menu.Append(wx.ID_CLOSE, "&Close", help="Close the WFK file")
        file_menu.Append(wx.ID_EXIT, "&Quit", help="Exit the application")
        file_menu.Append(ID_NCDUMP, "Ncdump", help="ncdump printout")
        menuBar.Append(file_menu, "File")

        file_history = self.file_history = wx.FileHistory(8)
        self.config = wx.Config(self.codename, style=wx.CONFIG_USE_LOCAL_FILE)
        file_history.Load(self.config)
        recent = wx.Menu()
        file_history.UseMenu(recent)
        file_history.AddFilesToMenu()
        file_menu.AppendMenu(wx.ID_ANY, "&Recent Files", recent)
        self.Bind(wx.EVT_MENU_RANGE, self.OnFileHistory, id=wx.ID_FILE1, id2=wx.ID_FILE9)

        self.help_menu = wx.Menu()
        self.help_menu.Append(wx.ID_ABOUT, "About " + self.codename, help="Info on the application")
        menuBar.Append(self.help_menu, "Help")

        self.SetMenuBar(menuBar)

        # Create toolbar.
        self.toolbar = toolbar = self.CreateToolBar()

        tsize = (48, 48)
        artBmp = wx.ArtProvider.GetBitmap
        toolbar.AddSimpleTool(wx.ID_OPEN, artBmp(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize), "Open")
        toolbar.AddSimpleTool(ID_VISTRUCT, wx.Bitmap(awx.path_img("struct.png")), "Visualize the crystal structure")
        toolbar.AddSimpleTool(ID_VISBZ, wx.Bitmap(awx.path_img("bz.png")), "Visualize the BZ")
        toolbar.AddSimpleTool(ID_VISWAVE, wx.Bitmap(awx.path_img("wfk.png")), "Visualize the selected wavefunction")
        toolbar.AddSimpleTool(ID_DOS, wx.Bitmap(awx.path_img("dos.png")), "Compute the DOS")
        toolbar.AddSimpleTool(ID_JDOS, wx.Bitmap(awx.path_img("jdos.png")), "Compute the joint DOS")
        toolbar.AddSimpleTool(ID_PLOTBANDS, wx.Bitmap(awx.path_img("bs.png")), "Plot bands")

        toolbar.AddSeparator()
        self.visualizer_cbox = wx.ComboBox(choices=supported_visunames(), id=ID_TBOX_VIS, 
            name='visualizer', parent=toolbar, value='xcrysden') 
        self.visualizer_cbox.Refresh() 

        toolbar.AddControl(control=self.visualizer_cbox) 

        self.toolbar.Realize()
        self.Centre()

        # Associate menu/toolbar items with their handlers.
        menu_handlers = [
            (wx.ID_OPEN, self.OnOpen),
            (wx.ID_CLOSE, self.OnClose),
            (wx.ID_EXIT, self.OnExit),
            (wx.ID_ABOUT, self.OnAboutBox),
            #
            (ID_NCDUMP, self.OnNcdump),
            (ID_VISTRUCT, self.OnVisualizeStructure),
            (ID_VISWAVE, self.OnVisualizeWave),
            (ID_VISBZ, self.OnVisualizeBZ),
            (ID_DOS, self.OnDos),
            (ID_JDOS, self.OnJdos),
            (ID_PLOTBANDS, self.OnPlotBands),
        ]

        for combo in menu_handlers:
            mid, handler = combo[:2]
            self.Bind(wx.EVT_MENU, handler, id=mid)

        self.wfk = None
        if filename is not None:
            self.ReadWfkFile(filename)
Пример #2
0
 def bitmap(path):
     return wx.Bitmap(awx.path_img(path))
Пример #3
0
 def bitmap(path):
     return wx.Bitmap(awx.path_img(path))
Пример #4
0
    def __init__(self, parent, flow, **kwargs):
        """
        Args:
            parent:
                Parent window.
            flow:
                `AbinitFlow` with the list of `Workflow` objects.
        """
        if "title" not in kwargs:
            kwargs["title"] = self.codename
            
        super(FlowViewerFrame, self).__init__(parent, -1, **kwargs)

        self.statusbar = self.CreateStatusBar()

        menuBar = wx.MenuBar()

        file_menu = wx.Menu()
        #file_menu.Append(wx.ID_OPEN, "&Open", help="Open an existing WFK file")
        #file_menu.Append(wx.ID_CLOSE, "&Close", help="Close the Viewer")
        #file_menu.Append(wx.ID_EXIT, "&Quit", help="Exit the application")
        menuBar.Append(file_menu, "File")

        #file_history = self.file_history = wx.FileHistory(8)
        #self.config = wx.Config(self.codename, style=wx.CONFIG_USE_LOCAL_FILE)
        #file_history.Load(self.config)
        #recent = wx.Menu()
        #file_history.UseMenu(recent)
        #file_history.AddFilesToMenu()
        #file_menu.AppendMenu(wx.ID_ANY, "&Recent Files", recent)
        #self.Bind(wx.EVT_MENU_RANGE, self.OnFileHistory, id=wx.ID_FILE1, id2=wx.ID_FILE9)

        help_menu = wx.Menu()
        help_menu.Append(wx.ID_ABOUT, "About " + self.codename, help="Info on the application")
        menuBar.Append(help_menu, "Help")

        self.SetMenuBar(menuBar)

        # Create toolbar.
        self.toolbar = toolbar = self.CreateToolBar()

        #tsize = (48,48)
        #artBmp = wx.ArtProvider.GetBitmap
        #toolbar.AddSimpleTool(wx.ID_OPEN, artBmp(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize), "Open")
        toolbar.AddSimpleTool(ID_SHOW_INPUTS, wx.Bitmap(awx.path_img("in.png")), "Visualize the input files of the workflow.")
        toolbar.AddSimpleTool(ID_SHOW_OUTPUTS, wx.Bitmap(awx.path_img("out.png")), "Visualize the output files of the workflow..")
        toolbar.AddSimpleTool(ID_SHOW_LOGS, wx.Bitmap(awx.path_img("log.png")), "Visualize the log files of the workflow.")
        toolbar.AddSimpleTool(ID_SHOW_JOB_SCRIPTS, wx.Bitmap(awx.path_img("script.png")), "Visualize the scripts.")
        toolbar.AddSimpleTool(ID_BROWSE, wx.Bitmap(awx.path_img("browse.png")), "Browse all the files of the workflow.")
        toolbar.AddSimpleTool(ID_SHOW_MAIN_EVENTS, wx.Bitmap(awx.path_img("out_evt.png")), "Show the ABINIT events reported in the main output files.")
        toolbar.AddSimpleTool(ID_SHOW_LOG_EVENTS, wx.Bitmap(awx.path_img("log_evt.png")), "Show the ABINIT events reported in the log files.")
        toolbar.AddSimpleTool(ID_SHOW_TIMERS, wx.Bitmap(awx.path_img("timer.png")), "Show the ABINIT timers in the abo files.")

        toolbar.AddSeparator()
        toolbar.AddSimpleTool(ID_CHECK_STATUS, wx.Bitmap(awx.path_img("refresh.png")), "Check the status of the workflow(s).")

        #toolbar.AddSeparator()
        #self.visualizer_cbox = wx.ComboBox(choices=supported_visunames(), id=ID_TBOX_VIS, 
        #    name='visualizer', parent=toolbar, value='xcrysden') 
        #self.visualizer_cbox.Refresh() 

        #toolbar.AddSeparator()
        self.toolbar.Realize()
        self.Centre()

        # Associate menu/toolbar items with their handlers.
        menu_handlers = [
            #(wx.ID_OPEN, self.OnOpen),
            #(wx.ID_CLOSE, self.OnClose),
            #(wx.ID_EXIT, self.OnExit),
            (wx.ID_ABOUT, self.OnAboutBox),
            #
            (ID_SHOW_INPUTS, self.OnShowInputs),
            (ID_SHOW_OUTPUTS, self.OnShowOutputs),
            (ID_SHOW_LOGS, self.OnShowLogs),
            (ID_SHOW_JOB_SCRIPTS, self.OnShowJobScripts),
            (ID_BROWSE, self.OnBrowse),
            (ID_SHOW_MAIN_EVENTS, self.OnShowMainEvents),
            (ID_SHOW_LOG_EVENTS, self.OnShowLogEvents),
            (ID_SHOW_TIMERS, self.OnShowTimers),
            (ID_CHECK_STATUS, self.OnCheckStatusButton),
        ]

        for combo in menu_handlers:
            mid, handler = combo[:2]
            self.Bind(wx.EVT_MENU, handler, id=mid)

        self.flow = flow

        #if filename is not None:
        #    self.ReadWorkflow(filename)

        self.BuildUi()
Пример #5
0
    def __init__(self, parent, filename=None, **kwargs):
        super(SigresViewerFrame, self).__init__(parent, id=-1, title=self.codename, **kwargs)

        self.statusbar = self.CreateStatusBar()

        menuBar = wx.MenuBar()

        file_menu = wx.Menu()
        file_menu.Append(wx.ID_OPEN, "&Open", help="Open an existing SIGRES file")
        file_menu.Append(wx.ID_CLOSE, "&Close", help="Close the SIGRES file")
        file_menu.Append(wx.ID_EXIT, "&Quit", help="Exit the application")
        file_menu.Append(ID_NCDUMP, "Ncdump", help="ncdump printout")
        menuBar.Append(file_menu, "File")

        file_history = self.file_history = wx.FileHistory(8)
        self.config = wx.Config(self.codename, style=wx.CONFIG_USE_LOCAL_FILE)
        file_history.Load(self.config)
        recent = wx.Menu()
        file_history.UseMenu(recent)
        file_history.AddFilesToMenu()
        file_menu.AppendMenu(wx.ID_ANY, "&Recent Files", recent)
        self.Bind(wx.EVT_MENU_RANGE, self.OnFileHistory, id=wx.ID_FILE1, id2=wx.ID_FILE9)

        self.help_menu = wx.Menu()
        self.help_menu.Append(wx.ID_ABOUT, "About " + self.codename, help="Info on the application")
        menuBar.Append(self.help_menu, "Help")

        self.SetMenuBar(menuBar)

        # Create toolbar.
        self.toolbar = toolbar = self.CreateToolBar()

        tsize = (48, 48)
        artBmp = wx.ArtProvider.GetBitmap
        toolbar.AddSimpleTool(wx.ID_OPEN, artBmp(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize), "Open")
        toolbar.AddSimpleTool(ID_VISTRUCT, wx.Bitmap(awx.path_img("struct.png")), "Visualize the crystal structure")
        toolbar.AddSimpleTool(ID_VISBZ, wx.Bitmap(awx.path_img("bz.png")), "Visualize the BZ")
        toolbar.AddSimpleTool(ID_PLOTQPSE0, wx.Bitmap(awx.path_img("qpresults.png")), "Plot QPState Results.")
        toolbar.AddSimpleTool(ID_PLOTKSWITHMARKS, wx.Bitmap(awx.path_img("qpmarkers.png")), "Plot KS energies with QPState markers.")
        toolbar.AddSimpleTool(ID_SCISSORS, wx.Bitmap(awx.path_img("qpscissor.png")), "Build energy-dependent scissors from GW correction.")

        toolbar.AddSeparator()
        self.visualizer_cbox = wx.ComboBox(choices=supported_visunames(), id=ID_TBOX_VIS,
            name='visualizer', parent=toolbar, value='xcrysden')
        self.visualizer_cbox.Refresh()

        toolbar.AddControl(control=self.visualizer_cbox)

        self.toolbar.Realize()
        self.Centre()

        # Associate menu/toolbar items with their handlers.
        menu_handlers = [
            (wx.ID_OPEN, self.OnOpen),
            (wx.ID_CLOSE, self.OnClose),
            (wx.ID_EXIT, self.OnExit),
            (wx.ID_ABOUT, self.OnAboutBox),
            #
            (ID_NCDUMP, self.OnNcdump),
            (ID_VISTRUCT, self.OnVisualizeStructure),
            (ID_VISBZ, self.OnVisualizeBZ),
            (ID_PLOTQPSE0, self.OnPlotQpsE0),
            (ID_PLOTKSWITHMARKS, self.OnPlotKSwithQPmarkers),
            (ID_SCISSORS, self.OnScissors),
        ]

        for combo in menu_handlers:
            mid, handler = combo[:2]
            self.Bind(wx.EVT_MENU, handler, id=mid)

        self.sigres = None
        if filename is not None:
            self.ReadSigresFile(filename)
Пример #6
0
 def bitmap(img_name):
     return wx.Bitmap(awx.path_img(img_name))