Beispiel #1
0
 def setUp(self) -> None:
     self.myapp = AppWindow()
     self.myapp.running_inside_unit_test = True
     self.myapp.ui.HAtomsCheckBox.setChecked(False)
     self.myapp.ui.ReportTextCheckBox.setChecked(False)
     self.myapp.ui.PictureWidthDoubleSpinBox.setValue(0.0)
     self.myapp.hide()
Beispiel #2
0
 def setUp(self) -> None:
     self.myapp = AppWindow()
     self.myapp.running_inside_unit_test = True
     self.myapp.setWindowIcon(QIcon('./icon/multitable.png'))
     self.myapp.setWindowTitle('FinalCif v{}'.format(VERSION))
     self.status = StatusBar(self.myapp.ui)
     self.myapp.hide()
Beispiel #3
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).resolve().parent.parent)
     self.testcif = Path('tests/examples/1979688.cif').resolve()
     self.myapp = AppWindow(self.testcif)
     self.myapp.running_inside_unit_test = True
     self.myapp.hide()  # For full screen view
     self.myapp.ui.LoopsPushButton.click()
Beispiel #4
0
    def do_activate(self):
        """If there's no window, create one and present it (show it to user).
        If there's a window, just present it. Also add the log handler
        and the notifier to the application"""

        # We only allow a single window and raise any existing ones
        if not self.window:
            # Windows are associated with the application
            # when the last one is closed the application shuts down
            self.window = AppWindow(self.sidebar,
                                    self.ws_sidebar,
                                    self.hosts_sidebar,
                                    self.terminal,
                                    self.console_log,
                                    self.statusbar,
                                    application=self,
                                    title="Faraday " + str(CONF.getVersion()))

        self.window.set_icon(self.icon)
        self.window.present()

        self.loghandler = GUIHandler()
        model.guiapi.setMainApp(self)
        addHandler(self.loghandler)
        self.loghandler.registerGUIOutput(self.window)

        notifier = model.log.getNotifier()
        notifier.widget = self.window
        model.guiapi.notification_center.registerWidget(self.window)

        if not CouchDbManager.testCouch(CONF.getCouchURI()):
            self.lost_db_connection(
                handle_connection_lost=self.handle_connection_lost,
                connect_to_a_different_couch=self.force_change_couch_url)
Beispiel #5
0
    def do_activate(self):
        """If there's no window, create one and present it (show it to user).
        If there's a window, just present it. Also add the log handler
        and the notifier to the application"""

        # We only allow a single window and raise any existing ones
        if not self.window:
            # Windows are associated with the application
            # when the last one is closed the application shuts down
            self.window = AppWindow(self.sidebar,
                                    self.terminal,
                                    self.console_log,
                                    self.statusbar,
                                    application=self,
                                    title="Faraday")

        self.window.set_icon(self.icon)
        self.window.present()

        self.loghandler = GUIHandler()
        model.guiapi.setMainApp(self)
        addHandler(self.loghandler)
        self.loghandler.registerGUIOutput(self.window)

        notifier = model.log.getNotifier()
        notifier.widget = self.window
        model.guiapi.notification_center.registerWidget(self.window)
Beispiel #6
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).absolute().parent.parent)
     self.testcif = Path(
         'tests/examples/work/cu_BruecknerJK_153F40_0m.cif').absolute()
     self.myapp = AppWindow(self.testcif)
     self.myapp.hide()
     self.myapp.setWindowIcon(QIcon('./icon/multitable.png'))
     self.myapp.setWindowTitle('FinalCif v{}'.format(VERSION))
Beispiel #7
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).absolute().parent.parent)
     self.myapp = AppWindow()
     self.myapp.running_inside_unit_test = True
     self.myapp.hide()
     self.myapp.setWindowIcon(QIcon('./icon/multitable.png'))
     self.myapp.setWindowTitle('FinalCif v{}'.format(VERSION))
     Path('foo.cif').unlink(missing_ok=True)
     Path('cu_BruecknerJK_153F40_0m-finalcif.cif').unlink(missing_ok=True)
Beispiel #8
0
 def do_activate(self):
     # We only allow a single window and raise any existing ones
     if not self.window:
         app_window = AppWindow(application=self, title="Sistema Básico")
         # Windows are associated with the application
         # when the last one is closed the application shuts down
         self.window = app_window.window
         self.window.set_application(self)
     self.window.present()
Beispiel #9
0
    def do_activate(self):
        """If there's no window, create one and present it (show it to user).
        If there's a window, just present it. Also add the log handler
        and the notifier to the application"""

        # We only allow a single window and raise any existing ones
        if not self.window:
            # Windows are associated with the application
            # when the last one is closed the application shuts down
            self.window = AppWindow(self.sidebar,
                                    self.ws_sidebar,
                                    self.hosts_sidebar,
                                    self.terminal,
                                    self.console_log,
                                    self.statusbar,
                                    application=self,
                                    title="Faraday " + str(CONF.getVersion()))

        self.window.set_icon(self.icon)
        self.window.present()

        self.loghandler = GUIHandler()
        model.guiapi.setMainApp(self)
        addHandler(self.loghandler)
        self.loghandler.registerGUIOutput(self.window)

        notifier = model.log.getNotifier()
        notifier.widget = self.window
        model.guiapi.notification_center.registerWidget(self.window)

        if self.serverIO.server_info() is None:

            should_login = self.lost_db_connection(
                handle_connection_lost=self.handle_connection_lost,
                connect_to_a_different_couch=self.force_change_couch_url)

            if not should_login:
                return

        if not is_authenticated(CONF.getServerURI(),
                                CONF.getDBSessionCookies()):
            loginDialog = ForceLoginDialog(self.window,
                                           self.exit_faraday_without_confirm)
            loginDialog.run(3, CONF.getServerURI(), self.window)
            self.reload_workspaces()

        workspace_argument_set = self.open_workspace_from_args()
        if not workspace_argument_set:
            self.open_last_workspace()
 def setUp(self) -> None:
     current_file_path()
     self.testcif = Path('tests/examples/1979688.cif').resolve()
     self.app = AppWindow(self.testcif)
     self.app.running_inside_unit_test = True
     self.app.hide()
     self.author = {
         'address': 'address',
         'footnote': 'footnote',
         'email': 'email',
         'name': 'name',
         'orcid': 'orcid',
         'phone': 'phone',
         'contact': True
     }
Beispiel #11
0
 def setUp(self) -> None:
     self.myapp = AppWindow()
     os.chdir(Path(__file__).absolute().parent.parent)
     self.testcif = Path('tests/examples/1979688.cif').absolute()
     self.myapp.load_cif_file(self.testcif.absolute())
     self.myapp.running_inside_unit_test = True
     self.myapp.ui.HAtomsCheckBox.setChecked(False)
     self.myapp.ui.ReportTextCheckBox.setChecked(False)
     self.myapp.ui.PictureWidthDoubleSpinBox.setValue(7.43)
     self.import_templates()
     self.myapp.ui.TemplatesListWidget.setCurrentRow(2)
     self.reportdoc = Path('report_' + self.testcif.stem + '-finalcif.docx')
     self.report_zip = Path(self.testcif.stem + '-finalcif.zip')
     self.myapp.set_report_picture(Path('../../icon/finalcif.png'))
     self.myapp.hide()
Beispiel #12
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).absolute().parent.parent)
     self.testcif = Path('tests/examples/1979688.cif').absolute()
     self.myapp = AppWindow(self.testcif)
     self.myapp.ui.HAtomsCheckBox.setChecked(False)
     self.myapp.ui.ReportTextCheckBox.setChecked(False)
     self.myapp.ui.PictureWidthDoubleSpinBox.setValue(0.0)
     # make sure to use no template:
     self.myapp.ui.TemplatesListWidget.setCurrentRow(0)
     self.myapp.running_inside_unit_test = True
     self.myapp.hide()
     self.reportdoc = Path('report_' + self.testcif.stem + '-finalcif.docx')
     self.report_zip = Path(self.testcif.stem + '-finalcif.zip')
     self.myapp.hide()
     app.processEvents()
Beispiel #13
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).absolute().parent.parent)
     self.myapp = AppWindow(Path('tests/examples/work/cu_BruecknerJK_153F40_0m.cif').absolute())
     self.myapp.hide()  # For full screen view
     self.resobj = Path('checkcif-' + strip_finalcif_of_name(self.myapp.cif.fileobj.stem) + '-finalcif.html')
Beispiel #14
0
        errortext += time.asctime(time.localtime(time.time())) + '\n'
        errortext += "Finalcif crashed during the following operation:" + '\n'
        errortext += '-' * 80 + '\n'
        errortext += ''.join(traceback.format_tb(error_traceback)) + '\n'
        errortext += str(exctype.__name__) + ': '
        errortext += str(value) + '\n'
        errortext += '-' * 80 + '\n'
        logfile = Path.home().joinpath(Path(r'finalcif-crash.txt'))
        try:
            logfile.write_text(errortext)
        except PermissionError:
            pass
        sys.__excepthook__(exctype, value, error_traceback)
        # Hier Fenster für meldung öffnen
        bug_found_warning(logfile)
        sys.exit(1)


    if not DEBUG:
        sys.excepthook = my_exception_hook

    app = QApplication(sys.argv)
    # windows_style = QStyleFactory.create('Fusion')
    # app.setStyle(windows_style)
    w = AppWindow()
    app.setWindowIcon(QIcon(os.path.join(application_path, r'icon/finalcif2.png')))
    w.setWindowTitle('FinalCif v{}'.format(VERSION))
    # w.showMaximized()  # For full screen view
    w.setBaseSize(1200, 780)
    sys.exit(app.exec_())
 def setUp(self) -> None:
     os.chdir(Path(__file__).resolve().parent.parent)
     self.myapp = AppWindow(Path('tests/examples/1979688.cif').resolve())
     self.myapp.hide()
     self.myapp.running_inside_unit_test = True
 def setUp(self) -> None:
     os.chdir(Path(__file__).resolve().parent.parent)
     self.myapp = AppWindow(Path('./test-data/1000007.cif').resolve())
     self.myapp.hide()
     self.myapp.ui.structfactCheckBox.setChecked(True)
     self.myapp.running_inside_unit_test = True
Beispiel #17
0
 def setUp(self) -> None:
     os.chdir(Path(__file__).absolute().parent.parent)
     self.testcif = Path('tests/examples/1979688.cif').absolute()
     self.myapp = AppWindow(self.testcif)
     self.myapp.running_inside_unit_test = True
     self.myapp.hide()  # For full screen view