-
Notifications
You must be signed in to change notification settings - Fork 1
/
disable_nrf_update.patch
55 lines (48 loc) · 1.91 KB
/
disable_nrf_update.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/nitrokeyapp/overview_tab.py b/nitrokeyapp/overview_tab.py
index b6f93e4..9741aaf 100644
--- a/nitrokeyapp/overview_tab.py
+++ b/nitrokeyapp/overview_tab.py
@@ -9,6 +9,7 @@ from nitrokeyapp.information_box import InfoBox
from nitrokeyapp.qt_utils_mix_in import QtUtilsMixIn
from nitrokeyapp.worker import Worker
+IS_FLATHUB = True
class OverviewTab(QtUtilsMixIn, QWidget):
busy_state_changed = Signal(bool)
@@ -29,6 +30,7 @@ class OverviewTab(QtUtilsMixIn, QWidget):
self.ui.pushButtonUpdate.clicked.connect(self.run_update)
self.reset()
+ self.disable_update_nrf()
@property
def title(self) -> str:
@@ -42,6 +44,15 @@ class OverviewTab(QtUtilsMixIn, QWidget):
def worker(self) -> Optional[Worker]:
return None
+ def disable_update_nrf(self) -> None:
+ if not self.data:
+ return None
+
+ if IS_FLATHUB and self.data.status.variant.name == "NRF52":
+ self.ui.pushButtonUpdate.setEnabled(False)
+ self.ui.more_options_btn.setEnabled(False)
+ self.ui.pushButtonUpdate.setToolTip("Update current not supported on Flatpak for Nitrokey 3 Mini")
+
def reset(self) -> None:
self.data = None
self.set_device_data("?", "?", "?", "?", "?")
@@ -80,6 +91,9 @@ class OverviewTab(QtUtilsMixIn, QWidget):
self.ui.nk3_lineedit_variant.setText(variant)
self.ui.nk3_lineedit_init_status.setText(init_status)
+
+ self.disable_update_nrf()
+
def status_error(self, init: InitStatus) -> None:
if init.is_error():
self.ui.warnNoticeIcon.show()
@@ -103,6 +117,8 @@ class OverviewTab(QtUtilsMixIn, QWidget):
self.ui.more_options_btn.setEnabled(enabled)
self.ui.more_options_btn.setToolTip(tooltip)
+ self.disable_update_nrf()
+
def update_btns_during_update(self, enabled: bool) -> None:
tooltip = ""
if enabled: