Beispiel #1
0
    def OnInit(self):

        self.frame = MainWindow(None, -1, title='CCTBX.XFEL')

        # select primary display and center on that
        self.frame.SetSize((800, -1))
        self.frame.SetMinSize(self.frame.GetEffectiveMinSize())
        self.frame.Center()

        # Start with login dialog before opening main window
        self.login = SettingsDialog(self.frame, self.frame.params)
        self.login.SetTitle('CCTBX.XFEL Login')
        self.login.Center()
        if (self.login.ShowModal() == wx.ID_OK):
            if self.frame.connect_to_db(drop_tables=self.login.drop_tables):
                self.exp_tag = '| {}'.format(self.login.db_cred.ctr.GetValue())
                self.exp = '| {}'.format(self.login.experiment.ctr.GetValue())
                self.frame.SetTitle('CCTBX.XFEL {} {}'.format(
                    self.exp, self.exp_tag))
                self.frame.Show(True)
                self.SetTopWindow(self.frame)
                #self.frame.start_run_sentinel()
                #self.frame.start_job_monitor()
                #self.frame.start_prg_sentinel()
                return True
            else:
                return False
        else:
            return False
class MainApp(wx.App):
    ''' App for the main GUI window  '''
    def OnInit(self):

        self.frame = MainWindow(None, -1, title='CCTBX.XFEL')

        # select primary display and center on that
        self.frame.SetSize((800, -1))
        minx, miny = self.frame.GetEffectiveMinSize()
        dispx, dispy = wx.GetDisplaySize()
        self.frame.SetMinSize((min(minx, dispx), min(miny, dispy)))
        self.frame.Center()

        # Start with login dialog before opening main window
        self.login = SettingsDialog(self.frame, self.frame.params)
        self.login.SetTitle('CCTBX.XFEL Login')
        self.login.Center()
        if (self.login.ShowModal() == wx.ID_OK):
            save_cached_settings(self.frame.params)
            if self.frame.connect_to_db(drop_tables=self.login.drop_tables):
                self.exp_tag = '| {}'.format(self.login.db_cred.ctr.GetValue())
                self.exp = '| {}'.format(self.login.experiment.ctr.GetValue())
                self.frame.SetTitle('CCTBX.XFEL {} {}'.format(
                    self.exp, self.exp_tag))
                self.frame.Show(True)
                self.SetTopWindow(self.frame)
                self.frame.onTabChange(None)
                #self.frame.start_run_sentinel()
                #self.frame.start_job_monitor()
                #self.frame.start_prg_sentinel()
                return True
            else:
                return False
        else:
            return False