예제 #1
0
    def show_login_window(self, parent: QObject = None):

        dialog: QDialog = LoginDialog(self)

        code = dialog.exec()

        if code == QDialog.Accepted:
            self._notify_listeners()

            # Enable auto-sync when the user logs in
            SyncConfig.get_instance().set(Vars.auto_sync, True)
예제 #2
0
    def __init__(self, view: FilesView):
        self.view = view
        self.old_notes: str = ""
        self._last_sync: datetime = None

        self.sync_config = SyncConfig.get_instance()
        self.api = API(self.sync_config.get_env())

        self.activity_log = ActivityLog()
        self.activity_syncer = ActivitySyncer(self.activity_log, self.api)
        self.association_cache = AssociationCache.init(self.sync_config.cache_dir)
        self.aws_login_manager = AwsLoginManager.get_instance()
        self.bucket_manager = BucketManager()
        self.cache_manager = FilesManager(self.sync_config.cache_dir)
        self.log_manager = LogManager.init(self.sync_config.cache_dir)

        self._is_offline = self.sync_config.get(Vars.offline_mode) or False
        self._is_connected = False
        self._serial_number = None
        self._inverter_id = None
        self._build_hash = None

        self._device_interface = None

        self._inverter_id_lookup: Dict[str, str] = {}  # serial -> inverter_id

        self.associations: [str, AssociationMapping] = {}
        self._log_rows: Dict[str, QTreeWidgetItem] = {}
예제 #3
0
    def __init__(self, file_dir=None):
        file_dir = file_dir or SyncConfig.get_instance().config_dir

        self._cache_file = path.join(file_dir, "activity-cache.json")

        self._activity_cache: [Event] = []
        self._listeners = []
        self._last_write_time = 0
예제 #4
0
    def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.aws_login_manager = AwsLoginManager.get_instance()
        self.aws_login_manager.register_listener(self.update_logged_in_state)
        self.files_config = SyncConfig.get_instance()

        # TODO: CAMPid 980567566238416124867857834291346779
        ico_file = os.path.join(QFileInfo.absolutePath(QFileInfo(__file__)),
                                "icon.ico")
        ico = QtGui.QIcon(ico_file)
        self.setWindowIcon(ico)

        self.ui = epyq.main_ui.Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.action_about.triggered.connect(self.about_dialog)
        self.ui.action_license.triggered.connect(self.license_dialog)
        self.ui.action_third_party_licenses.triggered.connect(
            self.third_party_licenses_dialog)

        self.ui.action_chart_log.triggered.connect(self.chart_log)

        self.ui.action_scripting.triggered.connect(self.scripting)

        self.ui.action_start_can_log.triggered.connect(self.start_can_log)
        self.ui.action_stop_can_log.triggered.connect(self.stop_can_log)
        self.ui.action_export_can_log.triggered.connect(self.export_can_log)
        self.can_logs = {}

        self.ui.action_login_to_sync.triggered.connect(
            self.login_to_sync_clicked)
        self.ui.action_auto_sync_files.triggered.connect(
            self.auto_sync_clicked)
        self.update_logged_in_state()

        device_tree = epyqlib.devicetree.Tree()
        self.device_tree_model = epyqlib.devicetree.Model(root=device_tree)
        self.device_tree_model.device_removed.connect(self._remove_device)
        self.ui.device_tree.setModel(self.device_tree_model)
        self.ui.device_tree.device_selected.connect(self.set_current_device)

        self.ui.collapse_button.clicked.connect(self.collapse_expand)
        size_hint = self.ui.collapse_button.sizeHint()
        size_hint.setWidth(0.75 * size_hint.width())
        size_hint.setHeight(6 * size_hint.width())
        self.ui.collapse_button.setMinimumSize(size_hint)
        self.ui.collapse_button.setMaximumSize(size_hint)

        self.subwindows = set()

        self.set_title()

        self.ui.stacked.currentChanged.connect(self.device_widget_changed)
        self.ui.device_tree.model.details_changed.connect(
            self.device_widget_changed, )

        self.scripting_window = None
예제 #5
0
    def __init__(self, environment: str):
        self._access_token = ""
        self._expires_in = 0
        self._expires_time = datetime.min
        self._id_token = ""
        self._decoded_id_token: dict = {}
        self._refresh_token = ""
        self._token_type = ""
        self.config = self.configs[environment]

        self._s3_resource: S3Resource = None

        self._session: Session = boto3.session.Session(
            region_name=self.config["region"],
            aws_access_key_id="",
            aws_secret_access_key="",
            aws_session_token="",
        )

        self._sync_config = SyncConfig.get_instance()