|
15 | 15 | from app.gui.key_rotation_dialog import RotateKeyDialog
|
16 | 16 | from app.gui.log_dialog import LogDialog
|
17 | 17 | from app.gui.trayicon import SystemTrayIcon
|
18 |
| -from core.core import Core |
19 |
| -from gui.mfa_dialog import MfaDialog |
20 |
| -from gui.repeater import Repeater |
| 18 | +from app.core.core import Core |
| 19 | +from app.gui.mfa_dialog import MfaDialog |
| 20 | +from app.gui.repeater import Repeater |
21 | 21 |
|
22 | 22 | logger = logging.getLogger('logsmith')
|
23 | 23 |
|
@@ -55,6 +55,21 @@ def login(self, profile_group: ProfileGroup):
|
55 | 55 | delay_seconds=300)
|
56 | 56 | self._to_login_state()
|
57 | 57 |
|
| 58 | + def login_gcp(self, profile_group: ProfileGroup): |
| 59 | + self._to_reset_state() |
| 60 | + self.tray_icon.disable_actions(True) |
| 61 | + |
| 62 | + result = self.core.login_gcp(profile_group=profile_group) |
| 63 | + if not self._check_and_signal_error(result): |
| 64 | + self._to_error_state() |
| 65 | + return |
| 66 | + |
| 67 | + logger.info('start repeater to remind login in 8 hours') |
| 68 | + prepare_login = partial(self.login_gcp, profile_group=profile_group) |
| 69 | + self.login_repeater.start(task=prepare_login, |
| 70 | + delay_seconds=8 * 60 * 60) |
| 71 | + self._to_login_state() |
| 72 | + |
58 | 73 | def logout(self):
|
59 | 74 | result = self.core.logout()
|
60 | 75 | self._check_and_signal_error(result)
|
@@ -109,7 +124,8 @@ def show_logs(self):
|
109 | 124 | self.log_dialog.show_dialog(logs_as_text)
|
110 | 125 |
|
111 | 126 | def _to_login_state(self):
|
112 |
| - self.tray_icon.setIcon(self.assets.get_icon(color_code=self.core.get_active_profile_color())) |
| 127 | + style = "full" if self.core.active_profile_group.type == "aws" else "gcp" |
| 128 | + self.tray_icon.setIcon(self.assets.get_icon(style=style, color_code=self.core.get_active_profile_color())) |
113 | 129 | self.tray_icon.disable_actions(False)
|
114 | 130 | self.tray_icon.update_last_login(self.get_timestamp())
|
115 | 131 |
|
|
0 commit comments