Skip to content
Snippets Groups Projects
Select Git revision
  • ddf8860f7a99b678d97cbb495be87e28a9ad8f5c
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
41 results

wot.deflate

Blame
    • Pascal Engélibert's avatar
      4234da98
      Distance Oracle (!105) · 4234da98
      Pascal Engélibert authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * Fix distance-oracle EvaluationPool type
      
      * Remove instanciation and dep to certification
      
      * Doc comments, make max size params const
      
      * Fix default distance dir
      
      * Rename pool accessors
      
      * doc add READMEs
      
      * fix(distance): Remember account_id who reserved
      
      * Log, comments, crate author
      
      * feat: distance
      
      * integration tests, expiration
      
      * fixes & working end2end tests
      
      * fix(distance): max_depth, compute min_certs_for_referee
      
      * fix(distance): add distance pallet to gtest, g1
      
      * test(distance): WiP end2end test
      
      * feat: distance
      4234da98
      History
      Distance Oracle (!105)
      Pascal Engélibert authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * Fix distance-oracle EvaluationPool type
      
      * Remove instanciation and dep to certification
      
      * Doc comments, make max size params const
      
      * Fix default distance dir
      
      * Rename pool accessors
      
      * doc add READMEs
      
      * fix(distance): Remember account_id who reserved
      
      * Log, comments, crate author
      
      * feat: distance
      
      * integration tests, expiration
      
      * fixes & working end2end tests
      
      * fix(distance): max_depth, compute min_certs_for_referee
      
      * fix(distance): add distance pallet to gtest, g1
      
      * test(distance): WiP end2end test
      
      * feat: distance
    controller.py 5.41 KiB
    import logging
    
    from PyQt5.QtCore import QEvent, pyqtSlot, QObject
    from PyQt5.QtGui import QIcon
    from PyQt5.QtWidgets import QMessageBox, QApplication
    
    from sakia.constants import ROOT_SERVERS
    from .model import MainWindowModel
    from .status_bar.controller import StatusBarController
    from .toolbar.controller import ToolbarController
    from .view import MainWindowView
    from ..navigation.controller import NavigationController
    from ..widgets import toast
    from ...__init__ import __version__
    
    
    class MainWindowController(QObject):
        """
        classdocs
        """
    
        def __init__(self, view, model, status_bar, toolbar, navigation):
            """
            Init
            :param MainWindowView view: the ui of the mainwindow component
            :param sakia.gui.main_window.model.MainWindowModel: the model of the mainwindow component
            :param sakia.gui.main_window.status_bar.controller.StatusBarController status_bar: the controller of the status bar component
            :param sakia.gui.main_window.toolbar.controller.ToolbarController toolbar: the controller of the toolbar component
            :param sakia.gui.navigation.controller.NavigationController navigation: the controller of the navigation
    
            :param PasswordAsker password_asker: the password asker of the application
            :type: sakia.core.app.Application
            """
            # Set up the user interface from Designer.
            super().__init__()
            self.view = view
            self.model = model
            self.initialized = False
            self.status_bar = status_bar
            self.toolbar = toolbar
            self.navigation = navigation
            self.stacked_widgets = {}
            self.view.bottom_layout.insertWidget(0, self.navigation.view)
            self.view.top_layout.addWidget(self.toolbar.view)
            self.view.setStatusBar(self.status_bar.view)
    
            QApplication.setWindowIcon(QIcon(":/icons/sakia_logo"))
    
        @classmethod
        def create(cls, app, status_bar, toolbar, navigation):
            """
            Instanciate a navigation component
            :param sakia.gui.status_bar.controller.StatusBarController status_bar: the controller of the status bar component
            :param sakia.gui.toolbar.controller.ToolbarController toolbar: the controller of the toolbar component
            :param sakia.gui.navigation.contoller.NavigationController navigation: the controller of the navigation
    
            :return: a new Navigation controller
            :rtype: MainWindowController
            """
            view = MainWindowView()
            model = MainWindowModel(None, app)
            main_window = cls(view, model, status_bar, toolbar, navigation)
            model.setParent(main_window)
            return main_window
    
        @classmethod
        def startup(cls, app):
            """
    
            :param sakia.app.Application app:
            :return:
            """
            navigation = NavigationController.create(None, app)
            toolbar = ToolbarController.create(app, navigation)
            main_window = cls.create(app, status_bar=StatusBarController.create(app),
                                     navigation=navigation,
                                     toolbar=toolbar
                                     )
            toolbar.view.button_network.clicked.connect(navigation.open_network_view)
            toolbar.view.button_identity.clicked.connect(navigation.open_identities_view)
            toolbar.view.button_explore.clicked.connect(navigation.open_wot_view)
            toolbar.exit_triggered.connect(main_window.view.close)
            #app.version_requested.connect(main_window.latest_version_requested)
            #app.account_imported.connect(main_window.import_account_accepted)
            #app.account_changed.connect(main_window.change_account)
            if app.parameters.maximized:
                main_window.view.showMaximized()
            else:
                main_window.view.show()
            main_window.model.load_plugins(main_window)
            main_window.refresh(app.currency)
            return main_window
    
        @pyqtSlot(str)
        def display_error(self, error):
            QMessageBox.critical(self, ":(",
                                 error,
                                 QMessageBox.Ok)
    
        @pyqtSlot(int)
        def referential_changed(self, index):
            pass
    
        @pyqtSlot()
        def latest_version_requested(self):
            latest = self.app.available_version
            logging.debug("Latest version requested")
            if not latest[0]:
                version_info = self.tr("Please get the latest release {version}") \
                    .format(version=latest[1])
                version_url = latest[2]
    
                if self.app.preferences['notifications']:
                    toast.display("sakia", """{version_info}""".format(
                    version_info=version_info,
                    version_url=version_url))
    
        def refresh(self, currency):
            """
            Refresh main window
            When the selected account changes, all the widgets
            in the window have to be refreshed
            """
            self.status_bar.refresh()
            display_name = ROOT_SERVERS[currency]["display"]
            self.view.setWindowTitle(self.tr("sakia {0} - {1}").format(__version__, display_name))
    
        def eventFilter(self, target, event):
            """
            Event filter on the widget
            :param QObject target: the target of the event
            :param QEvent event: the event
            :return: bool
            """
            if target == self.widget:
                if event.type() == QEvent.LanguageChange:
                    self.ui.retranslateUi(self)
                    self.refresh()
                return self.widget.eventFilter(target, event)
            return False