Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[optional] remove help widget and always open the browser instead #76

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions travel_time_platform_plugin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import io
import json
import os.path
import webbrowser

import processing
from qgis.core import Qgis, QgsApplication
Expand Down Expand Up @@ -51,7 +52,6 @@ def initGui(self):
# Add GUI elements
self.splash_screen = ui.SplashScreen(self)
self.config_dialog = ui.ConfigDialog()
self.help_dialog = ui.HelpWidget(self)
self.tilesManager = tiles.TilesManager(self)

self.toolbar = self.iface.addToolBar("TravelTime platform Toolbar")
Expand Down Expand Up @@ -271,7 +271,7 @@ def show_splash(self):
self.splash_screen.show()

def show_help(self):
self.help_dialog.show()
webbrowser.open("https://hubs.ly/H0rnCjY0")

def init_finished(self):
# Show splash screen
Expand Down
50 changes: 3 additions & 47 deletions travel_time_platform_plugin/ui.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import os
import webbrowser

from qgis.PyQt import uic
from qgis.PyQt.QtCore import QDate, QDateTime, QSettings, Qt, QTime, QUrl
from qgis.PyQt.QtWidgets import QDateTimeEdit, QDialog, QWidget

try:
from qgis.PyQt.QtWebKitWidgets import QWebView

webkit_available = True
except (ModuleNotFoundError, ImportError):
webkit_available = False

from processing.gui.wrappers import WidgetWrapper
from qgis.PyQt import uic
from qgis.PyQt.QtCore import QDate, QDateTime, QSettings, Qt, QTime
from qgis.PyQt.QtWidgets import QDateTimeEdit, QDialog

from . import auth, cache, constants
from .utils import tr
Expand Down Expand Up @@ -168,42 +160,6 @@ def accept(self, *args, **kwargs):
super().accept(*args, **kwargs)


class HelpWidget(QWidget):

home = "https://hubs.ly/H0rnCjY0"

def __init__(self, main, *args, **kwargs):
super().__init__(*args, **kwargs)
uic.loadUi(os.path.join(os.path.dirname(__file__), "ui", "HelpDialog.ui"), self)

self.closeButton.pressed.connect(self.close)
self.openBrowserButton.pressed.connect(self.open_in_browser)
self.homeButton.pressed.connect(self.reset_url)

self.main = main

if webkit_available:
self.webview = QWebView()
self.reset_url()
self.contentWidget.layout().addWidget(self.webview)
else:
self.webview = None

def show(self):
if self.webview:
self.raise_()
super().show()
else:
webbrowser.open(self.home)

def reset_url(self):
self.webview.setUrl(QUrl(self.home))

def open_in_browser(self):
webbrowser.open(self.webview.url().toString())
self.close()


class IsoDateTimeWidgetWrapper(WidgetWrapper):
def createWidget(self):
now = QTime.currentTime()
Expand Down
119 changes: 0 additions & 119 deletions travel_time_platform_plugin/ui/HelpDialog.ui

This file was deleted.