diff --git a/pythonlib/camoufox/gui/backend.py b/pythonlib/camoufox/gui/backend.py index b5380c9..5fa9f1d 100644 --- a/pythonlib/camoufox/gui/backend.py +++ b/pythonlib/camoufox/gui/backend.py @@ -272,6 +272,7 @@ class Backend(QObject): self._worker = None self._channel_data = None + self._geoip_available = False self._geoip_sources = [] self._geoip_names = [] self._geoip_installed = "" @@ -335,6 +336,10 @@ class Backend(QObject): item = self._version_model.get(self._selected) return item.is_prerelease if item else False + @Property(bool, notify=geoipChanged) + def geoipAvailable(self): + return self._geoip_available + @Property(list, notify=geoipChanged) def geoipSources(self): return self._geoip_sources @@ -788,9 +793,11 @@ class Backend(QObject): ) if not ALLOW_GEOIP: + self._geoip_available = False self.geoipChanged.emit() return + self._geoip_available = True repos, _ = _load_geoip_repos() self._geoip_names = self._geoip_sources = [r.get('name', '?') for r in repos] diff --git a/pythonlib/camoufox/gui/qml/main.qml b/pythonlib/camoufox/gui/qml/main.qml index a296e82..c38398c 100644 --- a/pythonlib/camoufox/gui/qml/main.qml +++ b/pythonlib/camoufox/gui/qml/main.qml @@ -861,8 +861,35 @@ ApplicationWindow { } } + Rectangle { + Layout.fillWidth: true + visible: !backend.geoipAvailable + height: visible ? notInstalledCol.height + s4 * 2 : 0 + color: c.fg + + ColumnLayout { + id: notInstalledCol + anchors.centerIn: parent + spacing: s2 + + T { + Layout.alignment: Qt.AlignHCenter + text: "IP Geolocation support is missing." + font.pixelSize: textMd + } + + T { + Layout.alignment: Qt.AlignHCenter + text: "Run: pip install camoufox[geoip]" + color: c.muted + font.family: root.fontMain + } + } + } + Column { Layout.fillWidth: true + visible: backend.geoipAvailable spacing: 0 Repeater { @@ -940,10 +967,11 @@ ApplicationWindow { } } - Rule { Layout.fillWidth: true; Layout.topMargin: s3 } + Rule { Layout.fillWidth: true; Layout.topMargin: s3; visible: backend.geoipAvailable } // IP Lookup ColumnLayout { + visible: backend.geoipAvailable Layout.fillWidth: true Layout.margins: s4 spacing: s2