def _set_text_rectangle(self, theme_data, rect_main, rect_footer): """ Sets the rectangle within which text should be rendered. :param theme_data: The theme data. :param rect_main: The main text block. :param rect_footer: The footer text block. """ self.log_debug('_set_text_rectangle {main} , {footer}'.format( main=rect_main, footer=rect_footer)) self._rect = rect_main self._rect_footer = rect_footer self.page_width = self._rect.width() self.page_height = self._rect.height() if theme_data.font_main_shadow: self.page_width -= int(theme_data.font_main_shadow_size) self.page_height -= int(theme_data.font_main_shadow_size) # For the life of my I don't know why we have to completely kill the QWebView in order for the display to work # properly, but we do. See bug #1041366 for an example of what happens if we take this out. self.web = None self.web = QtWebKitWidgets.QWebView() self.web.setVisible(False) self.web.resize(self.page_width, self.page_height) self.web_frame = self.web.page().mainFrame() # Adjust width and height to account for shadow. outline done in css. html = Template("""<!DOCTYPE html><html><head><script> function show_text(newtext) { var main = document.getElementById('main'); main.innerHTML = newtext; // We need to be sure that the page is loaded, that is why we // return the element's height (even though we do not use the // returned value). return main.offsetHeight; } </script> <style> *{margin: 0; padding: 0; border: 0;} #main {position: absolute; top: 0px; ${format_css} ${outline_css}} ${chords_css} </style></head> <body><div id="main"></div></body></html>""") self.web.setHtml( html.substitute(format_css=build_lyrics_format_css( theme_data, self.page_width, self.page_height), outline_css=build_lyrics_outline_css(theme_data), chords_css=build_chords_css())) self.empty_height = self.web_frame.contentsSize().height()
def __init__(self, parent=None): super(browser, self).__init__(parent) self.setupUi(self) self.webView = QtWebKitWidgets.QWebView() self.webView.setObjectName("webView") self.netManager = QtNetwork.QNetworkAccessManager() self.webView.page().setNetworkAccessManager(self.netManager) self.verticalLayout.addWidget(self.webView) self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(1, 20) self.urlEdit.returnPressed.connect(self.on_goButton_released) self.webView.loadFinished.connect(self.on_webView_titleChanged) self.webView.loadFinished.connect(self.on_webView_urlChanged) self.webView.page().setForwardUnsupportedContent(True) self.webView.page().downloadRequested.connect(self.on_downloadRequest) self.webView.page().unsupportedContent.connect( self.on_unsupportedContent)
def __init__(self, parentWidget, callback): self.parentWidget = parentWidget self.callback = callback self.url_provider = None self.timeout = 0 self.url_timeout = 10000 # milliseconds self.qrect = QtCore.QRect(0, 0, 100, 100) self.animate = True self.animation = None self._timers = WidgetTimers(self._done, self._show_next_url, self._done) self._parent = QtWidgets.QWidget(self.parentWidget) self._parent.hide() self._webEngineView1 = QtWebKitWidgets.QWebView(self._parent) self._webEngineView1.setStyleSheet("background: transparent") self._webEngineView1.setHtml("") # prevents blurry background self._done_timeout = 2000 # wait 2 seconds when no entries were shown to prevent high cpu usage
def openUrl(url): global maxWebWindows,webWindows reuseLast=False # use the last window if the class is the same and only the attribute differs try: reuseLast=(len(webWindows)>0 and str(webWindows[-1].url()).split('#')[-1].split('.')[2]==url.split('#')[-1].split('.')[2]) #print str(webWindows[-1].url()).split('#')[-1].split('.')[2],url.split('#')[-1].split('.')[2] except: pass if not reuseLast: if len(webWindows)<maxWebWindows: webWindows.append(QtWebKitWidgets.QWebView()) else: webWindows=webWindows[1:]+[webWindows[0]] web=webWindows[-1] web.page().networkAccessManager().sslErrors.connect(sslErrorHandler) web.load(QUrl(url)) web.setWindowTitle(url) web.setFocus() web.show()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(680, 30, 120, 551)) self.groupBox.setStyleSheet("background-color: black; color: white;") self.groupBox.setObjectName("groupBox") self.pushButton = QtWidgets.QPushButton(self.groupBox) self.pushButton.setGeometry(QtCore.QRect(20, 40, 80, 80)) self.pushButton.setStyleSheet("background-image: url(\"f.png\");") self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.pushButton_4 = QtWidgets.QPushButton(self.groupBox) self.pushButton_4.setGeometry(QtCore.QRect(20, 340, 80, 80)) self.pushButton_4.setStyleSheet("background-image: url(\"f.png\");") self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.pushButton_5 = QtWidgets.QPushButton(self.groupBox) self.pushButton_5.setGeometry(QtCore.QRect(20, 440, 80, 80)) self.pushButton_5.setStyleSheet("background-image: url(\"f.png\");") self.pushButton_5.setText("") self.pushButton_5.setObjectName("pushButton_5") self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(60, 80, 431, 411)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setGeometry(QtCore.QRect(550, 230, 80, 80)) self.pushButton_2.setStyleSheet("background-image: url(\"f.png\");") self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setGeometry(QtCore.QRect(550, 340, 80, 80)) self.pushButton_3.setStyleSheet("background-image: url(\"f.png\");") self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.pushButton.clicked.connect(self.direct) self.pushButton_2.clicked.connect(self.groupBox.hide) self.pushButton_3.clicked.connect(self.groupBox.show) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent, input, mode): if mode not in zetom: raise ValueError('Unknown mode') self.app = qtw.QApplication(sys.argv) self.parent = parent self.input = input self.mode = mode super().__init__() self.resize(1000, 600) self.html = webkit.QWebView(self) self.setCentralWidget(self.html) title = '{} via htmlfrom{}.py'.format(input, mode) self.setWindowTitle(title) failed = self.refresh_display(input, mode) if failed: sys.exit() self.show() sys.exit(self.app.exec_())
def __init__(self, controller): super(MainWindow, self).__init__() self._controller = controller self._controller.set_main_window(self) app_icon_path = os.path.join(utils.get_resources_dir(), "app.ico") self.setWindowIcon(QtGui.QIcon(app_icon_path)) self.setWindowTitle('V-Magine - OpenStack Installer') self._web = QtWebKitWidgets.QWebView() self._web.setPage(QWebPageWithoutJsWarning(self._web)) width = 1020 heigth = 768 self.resize(width, heigth) self.setCentralWidget(self._web) self._web.loadFinished.connect(self.onLoad) page = self._web.page() page.settings().setAttribute( QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) page.settings().setAttribute( QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True) frame = page.mainFrame() page.setViewportSize(frame.contentsSize()) if os.name == 'nt': appid = 'v_magine.1.0.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( appid) web_dir = utils.get_web_dir() self._web.setUrl( QtCore.QUrl.fromLocalFile(os.path.join(web_dir, "index.html"))) self.setFixedSize(width, heigth) self._web.show()
def __init__(self): """ Initialise the renderer. """ super(Renderer, self).__init__(None) # Need live behaviour if this is also working as a pseudo MainDisplay. self.screens = ScreenList() self.theme_level = ThemeLevel.Global self.global_theme_name = '' self.service_theme_name = '' self.item_theme_name = '' self.force_page = False self._theme_dimensions = {} self._calculate_default() self.web = QtWebKitWidgets.QWebView() self.web.setVisible(False) self.web_frame = self.web.page().mainFrame() Registry().register_function('theme_update_global', self.set_global_theme)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 645) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(439, 10, 351, 291)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.sarjalista = QtWidgets.QListWidget(self.centralwidget) self.sarjalista.setGeometry(QtCore.QRect(20, 10, 381, 291)) self.sarjalista.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.sarjalista.setObjectName("sarjalista") self.sarjalista.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.sarjalista.clicked.connect(self.etsi) self.sarjatiedot = QtWidgets.QTableWidget(self.centralwidget) self.sarjatiedot.setGeometry(QtCore.QRect(20, 320, 381, 281)) self.sarjatiedot.setEditTriggers(QtWidgets.QAbstractItemView.DoubleClicked|QtWidgets.QAbstractItemView.EditKeyPressed) self.sarjatiedot.setObjectName("sarjatiedot") self.sarjatiedot.setColumnCount(0) self.sarjatiedot.setRowCount(0) self.tallenna = QtWidgets.QPushButton(self.centralwidget) self.tallenna.setGeometry(QtCore.QRect(440, 370, 191, 101)) self.tallenna.setObjectName("tallenna") self.tallenna.clicked.connect(self.paivita_kokolista) self.sarjaid = QtWidgets.QLineEdit(self.centralwidget) self.sarjaid.setGeometry(QtCore.QRect(530, 320, 230, 32)) self.sarjaid.setObjectName("sarjaid") self.nappaaurl = QtWidgets.QPushButton(self.centralwidget) self.nappaaurl.setGeometry(QtCore.QRect(440, 320, 88, 34)) self.nappaaurl.setObjectName("nappaaurl") self.nappaaurl.clicked.connect(self.id_urlista) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(757, 498) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(40, 30, 671, 381)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 757, 22)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, url): super(MainWindow, self).__init__() app_icon_path = os.path.join(utils.get_resources_dir(), "app.ico") self.setWindowIcon(QtGui.QIcon(app_icon_path)) self.setWindowTitle(constants.PRODUCT_NAME) self.resize(1024, 768) self._web = QtWebKitWidgets.QWebView() self._status_bar_label = QtWidgets.QLabel('Loading... ') self._progressbar = QtWidgets.QProgressBar() self._progressbar.setMinimum(0) self._progressbar.setMaximum(100) self.setCentralWidget(self._web) self.statusBar().addPermanentWidget(self._status_bar_label) self.statusBar().addPermanentWidget(self._progressbar, 1) self._web.loadStarted.connect(self.load_started) self._web.loadProgress.connect(self.load_progress) self._web.loadFinished.connect(self.load_finished) self._web.urlChanged.connect(self.url_changed) page = self._web.page() page.settings().setAttribute( QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) frame = page.mainFrame() page.setViewportSize(frame.contentsSize()) if os.name == 'nt': appid = 'v_magine.1.0.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( appid) self._web.load(QtCore.QUrl(url)) self._web.show()
def setupUi(self, Window): Window.setObjectName("Window") self.centralwidget = QtWidgets.QWidget(Window) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.zk = None self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setObjectName("webView") self.webView.setRenderHint(QPainter.Antialiasing, True) self.webView.setRenderHint(QPainter.TextAntialiasing, True) self.webView.setRenderHint(QPainter.SmoothPixmapTransform, True) self.webView.setRenderHint(QPainter.HighQualityAntialiasing, True) self.webView.setPage(WebPage()) frame = self.webView.page().mainFrame() frame.javaScriptWindowObjectCleared.connect(self.initJsComm) self.verticalLayout.addWidget(self.webView) Window.setCentralWidget(self.centralwidget) self.retranslateUi(Window) QtCore.QMetaObject.connectSlotsByName(Window) self.loadDefaultAcl()
def __init__(self): """ Create main window with browser and a button """ super(MainBrowserWindow, self).__init__() self.resize(960, 1024) self.centralwidget = QtWidgets.QWidget(self) self.mainLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.frame = QtWidgets.QFrame(self.centralwidget) self.gridLayout = QtWidgets.QVBoxLayout(self.frame) self.horizontalLayout = QtWidgets.QHBoxLayout() self.tb_url = QtWidgets.QLineEdit(self.frame) self.bt_back = QtWidgets.QPushButton(self.frame) self.bt_ahead = QtWidgets.QPushButton(self.frame) self.bt_back.setIcon(QtGui.QIcon().fromTheme("go-previous")) self.bt_ahead.setIcon(QtGui.QIcon().fromTheme("go-next")) self.bt_back.setHidden(True) self.bt_ahead.setHidden(True) self.tb_url.setHidden(True) # self.horizontalLayout.addWidget(self.bt_back) # self.horizontalLayout.addWidget(self.bt_ahead) # self.horizontalLayout.addWidget(self.tb_url) self.gridLayout.addLayout(self.horizontalLayout) self.webview = QtWebKitWidgets.QWebView() self.gridLayout.addWidget(self.webview) self.mainLayout.addWidget(self.frame) self.setCentralWidget(self.centralwidget) self.tb_url.returnPressed.connect(self.browse) self.bt_back.clicked.connect(self.webview.back) self.bt_ahead.clicked.connect(self.webview.forward) self.webview.urlChanged.connect(self.url_changed) self.set_form_handler(self._default_form_handler)
def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent) self.request = None self.startpage = STARTPAGE self.blankpage = BLANKPAGE self.webView = QtWebKitWidgets.QWebView() self.webView.setPage(WebPage()) self.webView.setAttribute(Qt.WA_TranslucentBackground, True) self.webView.setAttribute(Qt.WA_OpaquePaintEvent, True) # self.webView.setTextSizeMultiplier(2.0) settings = self.webView.settings() settings.setAttribute( QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True) settings.setAttribute( QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True) settings.setAttribute( QtWebKit.QWebSettings.LocalContentCanAccessFileUrls, True) settings.setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True) settings.setAttribute(QtWebKit.QWebSettings.AutoLoadImages, True) self.setCentralWidget(self.webView) palette = self.centralWidget().palette() palette.setBrush(QtGui.QPalette.Base, Qt.black) self.centralWidget().setPalette(palette) self.webView.setHtml(self.startpage) self.setWindowTitle("eMonitor-Client id ({}) - {}".format(ID, VERSION)) self.thread = QtCore.QThread() self.ad_listener = AD_Listener() self.ad_listener.moveToThread(self.thread) self.thread.started.connect(self.ad_listener.loop) self.ad_listener.message.connect(self.signal_received) QtCore.QTimer.singleShot(0, self.thread.start)
def __init__(self, parent=None): super(WebkitBasePage, self).__init__(parent) self.parent = parent QtWebKit.QWebSettings.globalSettings().setAttribute(\ QtWebKit.QWebSettings.PluginsEnabled, True) QtNetwork.QNetworkProxyFactory.setUseSystemConfiguration(True) self.view = QtWebKitWidgets.QWebView(self) self.view.setFocus() self.setupInspector() self.splitter = QtWidgets.QSplitter(self) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.addWidget(self.view) self.splitter.addWidget(self.webInspector) mainlayout = QtWidgets.QVBoxLayout(self) mainlayout.addWidget(self.splitter) mainlayout.setContentsMargins(0, 0, 0, 0) mainlayout.setSpacing(0) self.setLayout(mainlayout)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(500, 600) self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.webView = QtWebKitWidgets.QWebView(Dialog) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.verticalLayout.addWidget(self.webView) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) f = open('rili2.html') content = f.read() self.webView.setHtml(content) a = self.webView.settings() a.setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True) self.webView.page().setLinkDelegationPolicy( QtWebKitWidgets.QWebPage.DelegateAllLinks) def link(url): QtGui.QDesktopServices.openUrl(url) self.webView.linkClicked.connect(link)
def setupInspector(self): self.page = self.view.SV.page() self.page.settings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) self.webInspector = QtWebKitWidgets.QWebInspector(self) self.webInspector.setPage(self.page)
def __init__(self, parent=None): """Constructor; initialise fields, load bookmarks and construct GUI.""" QtWidgets.QDialog.__init__(self, parent) settings = QtCore.QSettings() settings.setIniCodec(QtCore.QTextCodec.codecForName("UTF-8")) # load timezone info and bookmarks self.tz = FPPTimezone() self.tz.loadTimezoneDB() self.bookmarks = FPPGeoBookmarks() try: self.bookmarks.loadList( [str(i) for i in settings.value("LocationBookmarks", [])]) except: pass # prepare progressbar (webpage loading progress) and webview self.progressbar = QtWidgets.QProgressBar() self.webview = QtWebKitWidgets.QWebView() # construct bookmark sidebar (bookmark list, add and delete button) self.list_locations = QtWidgets.QListWidget() for name, location in self.bookmarks.listLocations(): item = QtWidgets.QListWidgetItem() item.setText(name) item.setToolTip("{0:9.4f}, {1:9.4f}".format(*location)) self.list_locations.addItem(item) self.button_add = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Add...")) self.button_add.setEnabled(False) self.button_add.setDisabled(True) self.button_del = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Delete")) self.button_del.setEnabled(False) self.button_del.setDisabled(True) layout_locbut = QtWidgets.QHBoxLayout() layout_locbut.addWidget(self.button_add) layout_locbut.addWidget(self.button_del) # construct controls for coordinates: lat/lon spinboxes, goto button button_goto = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Go to")) button_goto.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) self.spin_latitude = QtWidgets.QDoubleSpinBox() self.spin_latitude.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.spin_latitude.setRange(-84.99999999, 85) self.spin_latitude.setDecimals(8) self.spin_latitude.setSuffix(" °") self.spin_latitude.setSingleStep(1) self.spin_latitude.setWrapping(True) self.spin_longitude = QtWidgets.QDoubleSpinBox() self.spin_longitude.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.spin_longitude.setRange(-179.99999999, 180) self.spin_longitude.setDecimals(8) self.spin_longitude.setSuffix(" °") self.spin_longitude.setSingleStep(1) self.spin_longitude.setWrapping(True) layout_latlon = QtWidgets.QFormLayout() layout_latlon.addRow( QtWidgets.QLabel( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Latitude:")), self.spin_latitude) layout_latlon.addRow( QtWidgets.QLabel( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Longitude:")), self.spin_longitude) # arrange widgets for sidebar and coordinates control layout_coord = QtWidgets.QHBoxLayout() layout_coord.addLayout(layout_latlon) layout_coord.addWidget(button_goto) layout_coord.setAlignment(QtCore.Qt.AlignTop) self.edit_search = QtWidgets.QLineEdit() button_search = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Find")) layout_search = QtWidgets.QHBoxLayout() layout_search.addWidget(self.edit_search) layout_search.addWidget(button_search) layout_locations = QtWidgets.QVBoxLayout() layout_locations.addLayout(layout_search) layout_locations.addWidget(self.list_locations) layout_locations.addLayout(layout_locbut) layout_locations.addLayout(layout_coord) locations = QtWidgets.QWidget() locations.setLayout(layout_locations) # create standard dialog buttons (ok/cancel) button_ok = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "OK")) button_cancel = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Cancel")) layout_buttons = QtWidgets.QHBoxLayout() layout_buttons.addStretch(1) layout_buttons.addWidget(button_ok) layout_buttons.addWidget(button_cancel) # integrate sidebar, controls, webpage and buttons into a central splitter layout_webview = QtWidgets.QVBoxLayout() layout_webview.addWidget(self.webview) layout_webview.addLayout(layout_buttons) webview = QtWidgets.QWidget() webview.setLayout(layout_webview) splitter = QtWidgets.QSplitter() splitter.setOrientation(QtCore.Qt.Horizontal) splitter.addWidget(locations) splitter.addWidget(webview) layout_central = QtWidgets.QVBoxLayout() layout_central.addWidget(self.progressbar) layout_central.addWidget(splitter) # wiring: connect widgets to methods self.webview.page().mainFrame().javaScriptWindowObjectCleared.connect( self.populateJavaScriptWindowObject) # self.connect( # self.webview.page().mainFrame(), # QtCore.SIGNAL('javaScriptWindowObjectCleared()'), # self.populateJavaScriptWindowObject # ) self.webview.loadStarted.connect(self.webViewLoadStarted) # self.connect( # self.webview, # QtCore.SIGNAL('loadStarted()'), # self.webViewLoadStarted # ) self.webview.loadProgress.connect(self.webViewLoadProgress) # self.connect( # self.webview, # QtCore.SIGNAL('loadProgress(int)'), # self.webViewLoadProgress # ) self.webview.loadFinished.connect(self.webViewLoadFinished) # self.connect( # self.webview, # QtCore.SIGNAL('loadFinished(bool)'), # self.webViewLoadFinished # ) button_ok.clicked.connect(self.accept) # self.connect( # button_ok, # QtCore.SIGNAL('clicked()'), # self.accept # ) button_cancel.clicked.connect(self.reject) # self.connect( # button_cancel, # QtCore.SIGNAL('clicked()'), # self.reject # ) self.finished.connect(self.writeLocationsToSettings) # self.connect( # self, # QtCore.SIGNAL('finished(int)'), # self.writeLocationsToSettings # ) button_search.clicked.connect(self.searchLocation) # self.connect( # button_search, # QtCore.SIGNAL('clicked()'), # self.searchLocation # ) self.button_add.clicked.connect(self.addLocation) # self.connect( # self.button_add, # QtCore.SIGNAL('clicked()'), # self.addLocation # ) self.button_del.clicked.connect(self.deleteLocation) # self.connect( # self.button_del, # QtCore.SIGNAL('clicked()'), # self.deleteLocation # ) self.list_locations.itemSelectionChanged.connect(self.selectionChanged) # self.connect( # self.list_locations, # QtCore.SIGNAL('itemSelectionChanged()'), # self.selectionChanged # ) self.list_locations.itemDoubleClicked.connect(self.loadLocation) # self.connect( # self.list_locations, # QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem*)'), # self.loadLocation # ) self.spin_latitude.valueChanged.connect(self.setMarkerAndGoTo) # self.connect( # self.spin_latitude, # QtCore.SIGNAL('valueChanged(double)'), # self.setMarkerAndGoTo # ) self.spin_longitude.valueChanged.connect(self.setMarkerAndGoTo) # self.connect( # self.spin_longitude, # QtCore.SIGNAL('valueChanged(double)'), # self.setMarkerAndGoTo # ) button_goto.clicked.connect(self.setMarkerAndGoTo) # self.connect( # button_goto, # QtCore.SIGNAL('clicked()'), # self.setMarkerAndGoTo # ) # start dialog by setting central layout and loading custom OSM page self.setLayout(layout_central) with open(os.path.join(sys.path[0], "FotoPreProcessorOSM.html"), "r") as f: self.webview.setHtml(f.read()) self.webview.show()
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(1200, 768) Dialog.setMinimumSize(QtCore.QSize(1200, 768)) self.horizontalLayout_6 = QtWidgets.QHBoxLayout(Dialog) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSizeConstraint( QtWidgets.QLayout.SetMinimumSize) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setSizeConstraint( QtWidgets.QLayout.SetMaximumSize) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setSizeConstraint( QtWidgets.QLayout.SetDefaultConstraint) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.radioButton_contentTable = QtWidgets.QRadioButton(Dialog) self.radioButton_contentTable.setMinimumSize(QtCore.QSize(120, 30)) self.radioButton_contentTable.setMaximumSize(QtCore.QSize(120, 30)) self.radioButton_contentTable.setStyleSheet( "background-color: rgb(204, 204, 204);\n" "padding-left:5px;") self.radioButton_contentTable.setChecked(True) self.radioButton_contentTable.setObjectName("radioButton_contentTable") self.horizontalLayout_4.addWidget(self.radioButton_contentTable) spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem) self.radioButton_chapter1 = QtWidgets.QRadioButton(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.radioButton_chapter1.sizePolicy().hasHeightForWidth()) self.radioButton_chapter1.setSizePolicy(sizePolicy) self.radioButton_chapter1.setMinimumSize(QtCore.QSize(120, 30)) self.radioButton_chapter1.setMaximumSize(QtCore.QSize(120, 30)) self.radioButton_chapter1.setStyleSheet( "background-color: rgb(204, 204, 204);padding-left:5px;") self.radioButton_chapter1.setObjectName("radioButton_chapter1") self.horizontalLayout_4.addWidget(self.radioButton_chapter1) spacerItem1 = QtWidgets.QSpacerItem(320, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.verticalLayout_2.addLayout(self.horizontalLayout_4) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setSizeConstraint( QtWidgets.QLayout.SetMaximumSize) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.webView = QtWebKitWidgets.QWebView(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(400, 720)) self.webView.setMaximumSize(QtCore.QSize(600, 16777215)) self.webView.setStyleSheet("background-color: rgb(230, 230, 230);") self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.horizontalLayout_5.addWidget(self.webView) self.verticalLayout_2.addLayout(self.horizontalLayout_5) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setObjectName("verticalLayout_4") self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.label_2 = QtWidgets.QLabel(Dialog) self.label_2.setMinimumSize(QtCore.QSize(80, 30)) self.label_2.setMaximumSize(QtCore.QSize(80, 30)) self.label_2.setAutoFillBackground(False) self.label_2.setStyleSheet("background-color: rgb(117, 117, 117);\n" "color: rgb(255, 255, 255);\n" "padding-left:6px;") self.label_2.setObjectName("label_2") self.horizontalLayout_8.addWidget(self.label_2) spacerItem2 = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem2) self.verticalLayout_4.addLayout(self.horizontalLayout_8) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.plainTextEdit = QtWidgets.QPlainTextEdit(Dialog) self.plainTextEdit.setMinimumSize(QtCore.QSize(300, 720)) self.plainTextEdit.setAcceptDrops(False) self.plainTextEdit.setReadOnly(True) self.plainTextEdit.setObjectName("plainTextEdit") self.horizontalLayout_9.addWidget(self.plainTextEdit) self.verticalLayout_4.addLayout(self.horizontalLayout_9) self.horizontalLayout.addLayout(self.verticalLayout_4) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(Dialog) self.label.setMinimumSize(QtCore.QSize(80, 30)) self.label.setMaximumSize(QtCore.QSize(80, 30)) self.label.setAutoFillBackground(False) self.label.setStyleSheet("background-color: rgb(117, 117, 117);\n" "color: rgb(255, 255, 255);\n" "padding-left:6px;") self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.presetButton = QtWidgets.QPushButton(Dialog) self.presetButton.setMinimumSize(QtCore.QSize(0, 30)) self.presetButton.setMaximumSize(QtCore.QSize(16777215, 30)) self.presetButton.setObjectName("presetButton") self.horizontalLayout_2.addWidget(self.presetButton) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem3) self.pushButtonPreview = QtWidgets.QPushButton(Dialog) self.pushButtonPreview.setMinimumSize(QtCore.QSize(0, 30)) self.pushButtonPreview.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButtonPreview.setObjectName("pushButtonPreview") self.horizontalLayout_2.addWidget(self.pushButtonPreview) self.pushButtonSave = QtWidgets.QPushButton(Dialog) self.pushButtonSave.setMinimumSize(QtCore.QSize(0, 30)) self.pushButtonSave.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButtonSave.setObjectName("pushButtonSave") self.horizontalLayout_2.addWidget(self.pushButtonSave) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setSizeConstraint( QtWidgets.QLayout.SetMinimumSize) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.textEdit = QtWidgets.QTextEdit(Dialog) self.textEdit.setMinimumSize(QtCore.QSize(500, 720)) self.textEdit.setMaximumSize(QtCore.QSize(600, 16777215)) self.textEdit.setStyleSheet("background-color: rgb(220, 220, 220);") self.textEdit.setFrameShape(QtWidgets.QFrame.NoFrame) self.textEdit.setFrameShadow(QtWidgets.QFrame.Plain) self.textEdit.setLineWidth(0) self.textEdit.setObjectName("textEdit") self.horizontalLayout_3.addWidget(self.textEdit) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout_6.addLayout(self.horizontalLayout) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
class FlaskServerThread(threading.Thread): def run(self): print("Start Flask Server!") flask_app.run(host="0.0.0.0") flask_app = Flask(__name__) @flask_app.route("/") def hello(): return render_template("index.html") if __name__ == "__main__": fserver = FlaskServerThread() fserver.setDaemon(True) fserver.start() qapp = QApplication(sys.argv) print("QT Ver: %s" % QT_VERSION_STR) if QV[0] == 5 and QV[1] >= 6: view = QWebEngineView() else: view = QtWebKitWidgets.QWebView() view.load(QUrl("http://localhost:5000")) view.show() sys.exit(qapp.exec_())
def __init__(self, parent): super(BrowserWindow, self).__init__(parent) self.view = QtWebKitWidgets.QWebView(self) self.setWindowTitle('Bitmask') self.resize(800, 600) self.load_app()
def setupUi(self, MapWindow): self.MapWindow = MapWindow MapWindow.setObjectName("MapWindow") MapWindow.resize(1402, 1050) MapWindow.setMinimumSize(QtCore.QSize(1402, 1050)) MapWindow.setMaximumSize(QtCore.QSize(1402, 1050)) self.centralwidget = QtWidgets.QWidget(MapWindow) self.centralwidget.setMinimumSize(QtCore.QSize(1402, 1025)) self.centralwidget.setMaximumSize(QtCore.QSize(1402, 1025)) self.centralwidget.setObjectName("centralwidget") self.backButton = QtWidgets.QPushButton(self.centralwidget) self.backButton.setGeometry(QtCore.QRect(60, 20, 93, 30)) self.backButton.setObjectName("backButton") # self.stepButton = QtWidgets.QPushButton(self.centralwidget) # self.stepButton.setGeometry(QtCore.QRect(1150, 20, 191, 30)) # self.stepButton.setObjectName("stepButton") self.customerLabel = QtWidgets.QLabel(self.centralwidget) self.customerLabel.setGeometry(QtCore.QRect(55, 720, 700, 31)) font = QtGui.QFont() font.setPointSize(14) font.setWeight(75) font.setBold(True) self.customerLabel.setFont(font) self.customerLabel.setObjectName("customerLabel") self.customerLabel.setStyleSheet("background-color: #32414b;") self.initialLabel = QtWidgets.QLabel(self.centralwidget) self.initialLabel.setGeometry(QtCore.QRect(60, 770, 600, 31)) self.initialLabel.setObjectName("initialLabel") self.initialLabel.setStyleSheet("background-color: #32414b;") self.finalLabel = QtWidgets.QLabel(self.centralwidget) self.finalLabel.setGeometry(QtCore.QRect(60, 800, 600, 31)) self.finalLabel.setObjectName("finalLabel") self.finalLabel.setStyleSheet("background-color: #32414b;") self.startLabel = QtWidgets.QLabel(self.centralwidget) self.startLabel.setGeometry(QtCore.QRect(730, 770, 361, 31)) self.startLabel.setObjectName("startLabel") self.startLabel.setStyleSheet("background-color: #32414b;") # self.arrivalLabel = QtWidgets.QLabel(self.centralwidget) # self.arrivalLabel.setGeometry(QtCore.QRect(730, 800, 361, 31)) # self.arrivalLabel.setObjectName("arrivalLabel") # self.arrivalLabel.setStyleSheet("background-color: #32414b;") self.distanceLabel = QtWidgets.QLabel(self.centralwidget) self.distanceLabel.setGeometry(QtCore.QRect(60, 830, 361, 31)) self.distanceLabel.setObjectName("distanceLabel") self.distanceLabel.setStyleSheet("background-color: #32414b;") self.durationLabel = QtWidgets.QLabel(self.centralwidget) self.durationLabel.setGeometry(QtCore.QRect(730, 800, 361, 31)) self.durationLabel.setObjectName("durationLabel") self.durationLabel.setStyleSheet("background-color: #32414b;") self.deliveryButton = QtWidgets.QPushButton(self.centralwidget) self.deliveryButton.setGeometry(QtCore.QRect(610, 950, 191, 41)) self.deliveryButton.setObjectName("pushButton") self.oneStar = QtWidgets.QRadioButton(self.centralwidget) self.oneStar.setGeometry(QtCore.QRect(555, 913, 61, 20)) self.oneStar.setObjectName("oneStar") self.twoStar = QtWidgets.QRadioButton(self.centralwidget) self.twoStar.setGeometry(QtCore.QRect(625, 913, 71, 20)) self.twoStar.setObjectName("twoStar") self.threeStar = QtWidgets.QRadioButton(self.centralwidget) self.threeStar.setGeometry(QtCore.QRect(705, 913, 81, 20)) self.threeStar.setObjectName("threeStar") self.fourStar = QtWidgets.QRadioButton(self.centralwidget) self.fourStar.setGeometry(QtCore.QRect(795, 913, 81, 20)) self.fourStar.setObjectName("fourStar") self.fiveStar = QtWidgets.QRadioButton(self.centralwidget) self.fiveStar.setGeometry(QtCore.QRect(895, 913, 95, 20)) self.fiveStar.setObjectName("fiveStar") self.rateLabel = QtWidgets.QLabel(self.centralwidget) self.rateLabel.setGeometry(QtCore.QRect(430, 910, 121, 25)) self.rateLabel.setObjectName("rateLabel") self.background = QtWidgets.QLabel(self.centralwidget) self.background.setGeometry(QtCore.QRect(0, 700, 1402, 181)) self.background.setStyleSheet("background-color: #32414b;") self.background.setText("") self.background.setObjectName("background") self.background.lower() font = QtGui.QFont() font.setPointSize(9.5) self.initialLabel.setFont(font) self.finalLabel.setFont(font) self.startLabel.setFont(font) # self.arrivalLabel.setFont(font) self.distanceLabel.setFont(font) self.durationLabel.setFont(font) self.radioButtons = [ self.oneStar, self.twoStar, self.threeStar, self.fourStar, self.fiveStar ] self.centralwidget.keyPressEvent = self.keyPressEvent MapWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MapWindow) self.statusbar.setObjectName("statusbar") MapWindow.setStatusBar(self.statusbar) self.backButton.clicked.connect(self.switch_mainWindow) self.deliveryButton.clicked.connect(self.delivery_complete) self.web = QtWebKitWidgets.QWebView(self.centralwidget) self.web.setGeometry(QtCore.QRect(0, 70, 1400, 610)) self.web.load( QtCore.QUrl( "https://www.google.com/maps/dir/" + self.formatForURL(self.currentUser.getAddress()) + "/" + self.formatForURL(self.currentUser.getCustomerAddress()))) self.web.show() self.retranslateUi(MapWindow) QtCore.QMetaObject.connectSlotsByName(MapWindow)
def browse(self): """browse an url""" url = self.tb_url.text() if self.tb_url.text() else self.default_url self.webview.setPage(QtWebKitWidgets.QWebPage()) self.webview.load(QtCore.QUrl(url)) self.webview.show()
def __init__(self, parent=None): QtWidgets.QStackedWidget.__init__(self, parent) self.diary_widget = parent self.patient_label = QtWidgets.QLabel() icon = QtGui.QIcon(":/search.png") self.get_patient_button = QtWidgets.QPushButton(icon, "") self.get_patient_button.setMaximumWidth(40) self.appt_listView = DraggableList(self) self.block_listView = DraggableList(self) self.item_delegate = ColouredItemDelegate(self) self.appointment_model = SimpleListModel(self) self.appt_listView.setModel(self.appointment_model) self.appt_listView.setItemDelegate(self.item_delegate) self.appt_listView.setSelectionModel( self.appointment_model.selection_model) self.appt_listView.setSelectionMode( QtWidgets.QListView.ContiguousSelection) block_model = BlockListModel(self) self.block_listView.setModel(block_model) icon = QtGui.QIcon(":vcalendar.png") diary_button = QtWidgets.QPushButton(icon, _("Diary")) diary_button.setToolTip(_("Open the patient's diary")) icon = QtGui.QIcon(":settings.png") settings_button = QtWidgets.QPushButton(icon, _("Options")) settings_button.setToolTip(_("Appointment Settings")) icon = QtGui.QIcon(":back.png") self.prev_appt_button = QtWidgets.QPushButton(icon, "") self.prev_appt_button.setToolTip(_("Previous appointment")) icon = QtGui.QIcon(":forward.png") self.next_appt_button = QtWidgets.QPushButton(icon, "") self.next_appt_button.setToolTip(_("Next available appointment")) icon = QtGui.QIcon(":forward.png") self.next_day_button = QtWidgets.QPushButton(icon, "") self.next_day_button.setToolTip(_("Next Day or Week")) icon = QtGui.QIcon(":back.png") self.prev_day_button = QtWidgets.QPushButton(icon, "") self.prev_day_button.setToolTip(_("Previous Day or Week")) icon = QtGui.QIcon(":first.png") self.first_appt_button = QtWidgets.QPushButton(icon, "") self.first_appt_button.setToolTip(_("First available appointment")) self.appt_controls_frame = QtWidgets.QWidget() layout = QtWidgets.QGridLayout(self.appt_controls_frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) layout.addWidget(diary_button, 0, 0, 1, 2) layout.addWidget(settings_button, 0, 3, 1, 2) layout.addWidget(self.prev_day_button, 1, 0) layout.addWidget(self.prev_appt_button, 1, 1) layout.addWidget(self.first_appt_button, 1, 2) layout.addWidget(self.next_appt_button, 1, 3) layout.addWidget(self.next_day_button, 1, 4) self.appt_controls_frame.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)) self.search_criteria_webview = QtWebKitWidgets.QWebView(self) self.search_criteria_webview.setMinimumHeight(100) self.search_criteria_webview.setHtml( _("No appointment selected for scheduling")) # now arrange the stacked widget # page 0 - Browsing mode self.browsing_webview = QtWebKitWidgets.QWebView(self) self.reset_browsing_webview() self.addWidget(self.browsing_webview) # page 1 -- scheduling mode widg = QtWidgets.QWidget() layout = QtWidgets.QGridLayout(widg) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.patient_label, 0, 0) layout.addWidget(self.get_patient_button, 0, 1) layout.addWidget(self.appt_listView, 2, 0, 1, 2) layout.addWidget(self.appt_controls_frame, 3, 0, 1, 2) layout.addWidget(self.search_criteria_webview, 4, 0, 1, 2) self.addWidget(widg) # page 2 -- blocking mode widg = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout(widg) layout.addWidget(self.block_listView) self.addWidget(widg) # page 4 -- notes mode self.notes_label = QtWidgets.QLabel( _("Select a patient to edit notes")) self.addWidget(self.notes_label) # connect signals self.get_patient_button.clicked.connect(self.find_patient) settings_button.clicked.connect(self.show_settings_dialog) self.prev_appt_button.clicked.connect(self.show_prev_appt) self.next_appt_button.clicked.connect(self.show_next_appt) self.prev_day_button.clicked.connect(self.show_prev_day) self.next_day_button.clicked.connect(self.show_next_day) self.first_appt_button.clicked.connect(self.find_first_appointment) diary_button.clicked.connect(self.show_pt_diary) self.appt_listView.selectionModel().selectionChanged.connect( self.selection_changed) self.appt_listView.doubleClicked.connect(self.appointment_2x_clicked)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1366, 800) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) self.textBrowser.setGeometry(QtCore.QRect(10, 570, 1341, 201)) self.textBrowser.setObjectName("textBrowser") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 60, 371, 215)) self.groupBox.setObjectName("groupBox") self.pushButton = QtWidgets.QPushButton(self.groupBox) self.pushButton.setGeometry(QtCore.QRect(10, 30, 351, 23)) self.pushButton.setObjectName("pushButton") self.pushButton_3 = QtWidgets.QPushButton(self.groupBox) self.pushButton_3.setGeometry(QtCore.QRect(10, 60, 351, 23)) self.pushButton_3.setObjectName("pushButton_3") self.pushButton_4 = QtWidgets.QPushButton(self.groupBox) self.pushButton_4.setGeometry(QtCore.QRect(10, 90, 351, 23)) self.pushButton_4.setObjectName("pushButton_4") self.pushButton_5 = QtWidgets.QPushButton(self.groupBox) self.pushButton_5.setGeometry(QtCore.QRect(10, 120, 351, 23)) self.pushButton_5.setObjectName("pushButton_5") self.pushButton_6 = QtWidgets.QPushButton(self.groupBox) self.pushButton_6.setGeometry(QtCore.QRect(10, 150, 351, 23)) self.pushButton_6.setObjectName("pushButton_6") self.pushButton_8 = QtWidgets.QPushButton(self.groupBox) self.pushButton_8.setGeometry(QtCore.QRect(180, 180, 181, 23)) self.pushButton_8.setObjectName("pushButton_8") self.pushButton_7 = QtWidgets.QPushButton(self.groupBox) self.pushButton_7.setGeometry(QtCore.QRect(10, 180, 171, 23)) self.pushButton_7.setObjectName("pushButton_7") self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_2.setGeometry(QtCore.QRect(390, 10, 965, 551)) self.groupBox_2.setObjectName("groupBox_2") self.widget = QtWebKitWidgets.QWebView(self.groupBox_2) self.widget.setGeometry(QtCore.QRect(10, 30, 945, 521)) self.widget.setObjectName("widget") self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setGeometry(QtCore.QRect(10, 10, 371, 61)) self.groupBox_3.setObjectName("groupBox_3") self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_3) self.pushButton_2.setGeometry(QtCore.QRect(290, 30, 75, 23)) self.pushButton_2.setObjectName("pushButton_2") self.lineEdit = QtWidgets.QLineEdit(self.groupBox_3) self.lineEdit.setGeometry(QtCore.QRect(10, 30, 271, 25)) self.lineEdit.setObjectName("lineEdit") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(10, 550, 46, 13)) self.label.setObjectName("label") self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setGeometry(QtCore.QRect(160, 300, 71, 23)) self.pushButton_9.setObjectName("pushButton_9") self.groupBox_3.raise_() self.groupBox_2.raise_() self.groupBox.raise_() self.textBrowser.raise_() self.label.raise_() self.pushButton_9.raise_() self.pushButton.setEnabled(False) self.pushButton_3.setEnabled(False) self.pushButton_4.setEnabled(False) self.pushButton_5.setEnabled(False) self.pushButton_6.setEnabled(False) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.pushButton_2.clicked.connect(self.load_db) self.pushButton.clicked.connect(self.list_with_most_attacks) self.pushButton_3.clicked.connect(self.visualize_with_most_attacks) self.pushButton_4.clicked.connect(self.list_with_most_casualties) self.pushButton_5.clicked.connect(self.list_by_dates) self.pushButton_6.clicked.connect(self.visualize_by_dates) self.pushButton_7.clicked.connect(self.visualize_word_cloud) self.pushButton_8.clicked.connect(self.visualize_world_map) self.pushButton_9.clicked.connect(self.close_app)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(768, 1300) MainWindow.setStyleSheet("color: white; background-color: black;") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 40, 311, 151)) self.groupBox.setStyleSheet( "color: white; background-color: black; border:0;") self.groupBox.setTitle("") self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setStyleSheet("color: white; background-color: black;") self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 2) self.label_2 = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.label_2.setFont(font) self.label_2.setStyleSheet("color: white; background-color: black;") self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.label_3.setFont(font) self.label_3.setStyleSheet( "color: white; background-color: black; border: 0;") self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 1, 1, 1, 1) self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setGeometry(QtCore.QRect(440, 10, 321, 211)) self.groupBox_3.setStyleSheet( "color: white; background-color: black; border:0;") self.groupBox_3.setTitle("") self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_3) self.gridLayout_3.setObjectName("gridLayout_3") self.label_15 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label_15.setFont(font) self.label_15.setStyleSheet("color: white; background-color: black;") self.label_15.setObjectName("label_15") self.gridLayout_3.addWidget(self.label_15, 1, 0, 1, 1) self.label_16 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_16.setFont(font) self.label_16.setStyleSheet("color: white; background-color: black;") self.label_16.setObjectName("label_16") self.gridLayout_3.addWidget(self.label_16, 2, 0, 1, 1) self.label_17 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_17.setFont(font) self.label_17.setStyleSheet("color: white; background-color: black;") self.label_17.setObjectName("label_17") self.gridLayout_3.addWidget(self.label_17, 3, 0, 1, 1) self.label_18 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_18.setFont(font) self.label_18.setStyleSheet("color: white; background-color: black;") self.label_18.setObjectName("label_18") self.gridLayout_3.addWidget(self.label_18, 4, 0, 1, 1) self.label_19 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_19.setFont(font) self.label_19.setStyleSheet("color: white; background-color: black;") self.label_19.setObjectName("label_19") self.gridLayout_3.addWidget(self.label_19, 1, 1, 1, 1) self.label_20 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_20.setFont(font) self.label_20.setStyleSheet("color: white; background-color: black;") self.label_20.setObjectName("label_20") self.gridLayout_3.addWidget(self.label_20, 4, 1, 1, 4) self.label_21 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.label_21.setFont(font) self.label_21.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_21.setStyleSheet("color: white; background-color: black;") self.label_21.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.label_21.setObjectName("label_21") self.gridLayout_3.addWidget(self.label_21, 0, 1, 1, 4) self.label_22 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(26) font.setBold(True) font.setWeight(75) self.label_22.setFont(font) self.label_22.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_22.setStyleSheet("color: white; background-color: black;") self.label_22.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.label_22.setObjectName("label_22") self.gridLayout_3.addWidget(self.label_22, 1, 4, 1, 1) self.label_23 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_23.setFont(font) self.label_23.setStyleSheet("color: white; background-color: black;") self.label_23.setObjectName("label_23") self.gridLayout_3.addWidget(self.label_23, 3, 1, 1, 4) self.label_24 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_24.setFont(font) self.label_24.setStyleSheet("color: white; background-color: black;") self.label_24.setObjectName("label_24") self.gridLayout_3.addWidget(self.label_24, 2, 1, 1, 4) self.label_25 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label_25.setFont(font) self.label_25.setStyleSheet("color: white; background-color: black;") self.label_25.setObjectName("label_25") self.gridLayout_3.addWidget(self.label_25, 1, 2, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_2.setGeometry(QtCore.QRect(640, 410, 131, 701)) self.groupBox_2.setStyleSheet("") self.groupBox_2.setObjectName("groupBox_2") self.pushButton = QtWidgets.QPushButton(self.groupBox_2) self.pushButton.setGeometry(QtCore.QRect(30, 30, 80, 80)) self.pushButton.setStyleSheet( "color:black; background-color:white;background-image: url(\"f.png\");" ) self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(self.wa) self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_2.setGeometry(QtCore.QRect(30, 140, 80, 80)) self.pushButton_2.setStyleSheet( "color:black; background-color:white; background-image: url(\"t.jpg\");" ) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_3.setGeometry(QtCore.QRect(30, 250, 80, 80)) self.pushButton_3.setStyleSheet( "color:black; background-color:white; background-image: url(\"i.png\");" ) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.pushButton_4 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_4.setGeometry(QtCore.QRect(30, 360, 80, 80)) self.pushButton_4.setStyleSheet( "color:black; background-color:white; background-image: url(\"l.jpg\");" ) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.pushButton_5 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_5.setGeometry(QtCore.QRect(30, 470, 80, 80)) self.pushButton_5.setStyleSheet( "color:black; background-color:white; background-image: url(\"g.png\");" ) self.pushButton_5.setText("") self.pushButton_5.setObjectName("pushButton_5") self.pushButton_6 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_6.setGeometry(QtCore.QRect(30, 580, 80, 80)) self.pushButton_6.setStyleSheet( "color:black; background-color:white; background-image: url(\"y.jpg\");" ) self.pushButton_6.setText("") self.pushButton_6.setObjectName("pushButton_6") self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setGeometry(QtCore.QRect(220, 1250, 371, 31)) font = QtGui.QFont() font.setPointSize(20) self.label_4.setFont(font) self.label_4.setObjectName("label_4") self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setGeometry(QtCore.QRect(730, 1130, 40, 40)) self.pushButton_7.setStyleSheet("background-image:url(\"w.png\");") self.pushButton_7.setText("") self.pushButton_7.setObjectName("pushButton_7") self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(20, 440, 591, 331)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.groupBox_4 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_4.setGeometry(QtCore.QRect(0, 220, 281, 61)) self.groupBox_4.setTitle("") self.groupBox_4.setObjectName("groupBox_4") self.dial = QtWidgets.QDial(self.centralwidget) self.dial.setGeometry(QtCore.QRect(650, 290, 111, 101)) self.dial.setStyleSheet("color: white; background-color:white;") self.dial.setObjectName("dial") self.webView_2 = QtWebKitWidgets.QWebView(self.centralwidget) self.webView_2.setGeometry(QtCore.QRect(20, 790, 591, 331)) self.webView_2.setUrl(QtCore.QUrl("about:blank")) self.webView_2.setObjectName("webView_2") self.lcdNumber = QtWidgets.QLCDNumber(self.centralwidget) self.lcdNumber.setGeometry(QtCore.QRect(480, 310, 171, 71)) font = QtGui.QFont() font.setPointSize(25) self.lcdNumber.setFont(font) self.lcdNumber.setObjectName("lcdNumber") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.dial.valueChanged['int'].connect(self.lcdNumber.display) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self): QtWidgets.QMainWindow.__init__(self) self.setWindowTitle("Guild Wars Quest Tracker") base = QtWidgets.QWidget(self) layout = QtWidgets.QGridLayout(base) layout.setContentsMargins(0, 0, 0, 0) split = QtWidgets.QSplitter(base) vsplit = QtWidgets.QSplitter(split) vsplit.setOrientation(QtCore.Qt.Vertical) self.areaView = QtWidgets.QTreeWidget(split) self.areaView.setRootIsDecorated(True) self.areaView.setHeaderHidden(True) self.questView = QtWidgets.QTreeWidget(vsplit) self.questView.setRootIsDecorated(False) self.questView.setHeaderLabels([ "Quest", "Type", "R", "Profession", "Character", "XP", "Reward", "Status" ]) metrics = QtGui.QFontMetrics(self.questView.headerItem().font(0)) self.questView.setColumnWidth(0, 240) self.questView.setColumnWidth(1, metrics.width("Mini-mission") + 10) self.questView.setColumnWidth(2, 20) self.questView.setColumnWidth(3, metrics.width("Necromancer (P)") + 30) self.questView.setColumnWidth(4, metrics.width("Canthan") + 30) self.questView.setColumnWidth(5, metrics.width("50,000") + 10) self.questView.setColumnWidth(7, metrics.width("Complete") + 10) fontSize = self.questView.headerItem().font(0).pointSize() if sys.platform == 'darwin': self.fixed_font = QtGui.QFont('Menlo', fontSize) elif os.name == 'nt': self.fixed_font = QtGui.QFont('Courier New', fontSize) else: self.fixed_font = QtGui.QFont('Monospace', fontSize) metrics = QtGui.QFontMetrics(self.fixed_font) self.questView.setColumnWidth(6, metrics.width("XXXXXXXXXX") + 10) self.questView.header().setSortIndicator(0, QtCore.Qt.AscendingOrder) self.questView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) wikiPane = QtWidgets.QWidget(vsplit) wikiLayout = QtWidgets.QGridLayout(wikiPane) wikiLayout.setContentsMargins(0, 0, 0, 0) wikiToolbar = QtWidgets.QToolBar(wikiPane) self.back = wikiToolbar.addAction(QtGui.QIcon("icons/arrow-left.png"), "Back") self.fwd = wikiToolbar.addAction(QtGui.QIcon("icons/arrow-right.png"), "Forward") wikiToolbar.addSeparator() self.location = QtWidgets.QComboBox(wikiPane) self.location.setEditable(True) self.location.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)) wikiToolbar.addWidget(self.location) self.refresh = wikiToolbar.addAction( QtGui.QIcon("icons/view-refresh.png"), "Refresh") wikiFrame = QtWidgets.QFrame(wikiPane) frameLayout = QtWidgets.QGridLayout(wikiFrame) frameLayout.setContentsMargins(0, 0, 0, 0) wikiFrame.setFrameShape(QtWidgets.QFrame.StyledPanel) wikiFrame.setFrameShadow(QtWidgets.QFrame.Sunken) self.wikiView = QtWebKitWidgets.QWebView(wikiFrame) frameLayout.addWidget(self.wikiView, 0, 0) wikiLayout.addWidget(wikiToolbar, 0, 0) wikiLayout.addWidget(wikiFrame, 1, 0) vsplit.addWidget(self.questView) vsplit.addWidget(wikiPane) split.addWidget(self.areaView) split.addWidget(vsplit) layout.addWidget(split, 0, 0) self.setCentralWidget(base) toolbar = self.addToolBar("MainToolbar") toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) toolbar.addWidget(QtWidgets.QLabel(" Character: ", self)) self.charSelect = QtWidgets.QComboBox(self) self.charSelect.insertSeparator(0) self.charSelect.addItem("Add New Character...") toolbar.addWidget(self.charSelect) toolbar.addSeparator() self.profSelect = toolbar.addAction("") self.prof2Select = toolbar.addAction("") self.areas = {} self.currentArea = None self.currentChar = None self.currentCharIdx = -1 self.areaView.itemSelectionChanged.connect(self.onAreaChange) self.questView.itemSelectionChanged.connect(self.onQuestChange) self.questView.customContextMenuRequested.connect(self.onQuestMenu) self.back.triggered.connect(self.wikiView.back) self.fwd.triggered.connect(self.wikiView.forward) self.refresh.triggered.connect(self.wikiView.reload) self.wikiView.urlChanged.connect(self.onUrlChanged) self.charSelect.activated[int].connect(self.onCharSelected) self.icons = { 'q_pri': QtGui.QIcon("icons/Tango-quest-icon-primary.png"), 'q_rep': QtGui.QIcon("icons/Tango-quest-icon-repeatable.png"), 'Assassin': QtGui.QIcon("icons/Assassin-tango-icon-20.png"), 'Dervish': QtGui.QIcon("icons/Dervish-tango-icon-20.png"), 'Elementalist': QtGui.QIcon("icons/Elementalist-tango-icon-20.png"), 'Mesmer': QtGui.QIcon("icons/Mesmer-tango-icon-20.png"), 'Monk': QtGui.QIcon("icons/Monk-tango-icon-20.png"), 'Necromancer': QtGui.QIcon("icons/Necromancer-tango-icon-20.png"), 'Paragon': QtGui.QIcon("icons/Paragon-tango-icon-20.png"), 'Ranger': QtGui.QIcon("icons/Ranger-tango-icon-20.png"), 'Ritualist': QtGui.QIcon("icons/Ritualist-tango-icon-20.png"), 'Warrior': QtGui.QIcon("icons/Warrior-tango-icon-20.png"), 'Tyrian': QtGui.QIcon("icons/Tyria.png"), 'Canthan': QtGui.QIcon("icons/Cantha.png"), 'Elonian': QtGui.QIcon("icons/Elona.png") }
def __init__(self): super().__init__() self.resize(1020, 900) self.html = webkit.QWebView(self) self.setCentralWidget(self.html)
def setupUi(self, MainWindow): """Auto generated method""" MainWindow.setObjectName("MainWindow") MainWindow.resize(679, 416) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.skeletonView = QtWebKitWidgets.QWebView(self.centralwidget) self.skeletonView.setUrl(QtCore.QUrl( "http://jaanga.github.io/gestification-r2/template-leap-threejs/pehrlich-threejs-bones/pehrlich-threejs-bones.html")) self.skeletonView.setObjectName("skeletonView") self.gridLayout_2.addWidget(self.skeletonView, 1, 0, 1, 3) self.labelCombo = QtWidgets.QComboBox(self.centralwidget) self.labelCombo.setStatusTip("") self.labelCombo.setObjectName("labelCombo") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.labelCombo.addItem("") self.gridLayout_2.addWidget(self.labelCombo, 0, 0, 1, 1) self.submitDataBtn = QtWidgets.QPushButton(self.centralwidget) self.submitDataBtn.setObjectName("submitDataBtn") self.gridLayout_2.addWidget(self.submitDataBtn, 2, 0, 1, 3) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.curLabel = QtWidgets.QLabel(self.centralwidget) font = QtGui.QFont() font.setPointSize(10) self.curLabel.setFont(font) self.curLabel.setObjectName("curLabel") self.gridLayout.addWidget(self.curLabel, 1, 0, 1, 1) self.iternum = QtWidgets.QLabel(self.centralwidget) font = QtGui.QFont() font.setPointSize(10) self.iternum.setFont(font) self.iternum.setObjectName("iternum") self.gridLayout.addWidget(self.iternum, 1, 1, 1, 1) self.timeleft = QtWidgets.QLabel(self.centralwidget) font = QtGui.QFont() font.setPointSize(10) self.timeleft.setFont(font) self.timeleft.setObjectName("timeleft") self.gridLayout.addWidget(self.timeleft, 1, 2, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 2, 1, 1) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.gridLayout_2.addWidget(self.line, 0, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout_2) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def initGui(self): # Create actions that will start plugin configuration self.StreetviewAction = QtWidgets.QAction(QtGui.QIcon(os.path.join(os.path.dirname(__file__), 'res', 'icoStreetview.png')), \ "Click to open Google Street View", self.iface.mainWindow()) #self.StreetviewAction = QtWidgets.QAction(QtGui.QIcon(":/plugins/go2streetview/res/icoStreetview.png"), \ # "Click to open Google Street View", self.iface.mainWindow()) self.StreetviewAction.triggered.connect(self.StreetviewRun) # Add toolbar button and menu item self.iface.addToolBarIcon(self.StreetviewAction) self.iface.addPluginToWebMenu("&go2streetview", self.StreetviewAction) self.dirPath = os.path.dirname( os.path.abspath( __file__ ) ) self.actualPOV = {} self.view = go2streetviewDialog() self.dumView = dumWidget() self.dumView.enter.connect(self.clickOn) self.dumView.iconRif.setPixmap(QtGui.QPixmap(os.path.join(os.path.dirname(__file__), 'res', 'icoStreetview.png'))) #self.dumView.iconRif.setPixmap(QtGui.QPixmap(":/plugins/go2streetview/res/icoStreetview.png")) self.apdockwidget=QtWidgets.QDockWidget("go2streetview" , self.iface.mainWindow() ) self.apdockwidget.setObjectName("go2streetview") self.apdockwidget.setWidget(self.dumView) self.iface.addDockWidget( QtCore.Qt.LeftDockWidgetArea, self.apdockwidget) self.apdockwidget.update() self.viewHeight=self.apdockwidget.size().height() self.viewWidth=self.apdockwidget.size().width() self.snapshotOutput = snapShot(self) self.view.SV.settings().globalSettings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True); self.view.SV.settings().globalSettings().setAttribute(QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True); self.view.SV.page().networkAccessManager().finished.connect(self.noSVConnectionsPending) self.view.SV.page().statusBarMessage.connect(self.catchJSevents) self.view.BE.page().statusBarMessage.connect(self.catchJSevents) self.view.btnSwitchView.setIcon(QtGui.QIcon(os.path.join(self.dirPath,"res","icoGMaps.png"))) self.view.enter.connect(self.clickOn) self.view.closed.connect(self.closeDialog) self.setButtonBarSignals() self.infoBoxManager = infobox(self) self.infoBoxManager.defined.connect(self.infoLayerDefinedAction) self.apdockwidget.visibilityChanged.connect(self.apdockChangeVisibility) self.iface.projectRead.connect(self.projectReadAction) self.pressed=None self.CTRLPressed=None self.controlShape = gui.QgsRubberBand(self.iface.mapCanvas(),core.QgsWkbTypes.LineGeometry ) self.controlShape.setWidth( 1 ) self.position=gui.QgsRubberBand(self.iface.mapCanvas(),core.QgsWkbTypes.PointGeometry ) self.position.setWidth( 5 ) self.position.setIcon(gui.QgsRubberBand.ICON_CIRCLE) self.position.setIconSize(6) self.position.setColor(QtCore.Qt.red) self.aperture=gui.QgsRubberBand(self.iface.mapCanvas(),core.QgsWkbTypes.LineGeometry ) self.rotateTool = transformGeometry() self.canvas.rotationChanged.connect(self.mapRotationChanged) self.canvas.scaleChanged.connect(self.setPosition) self.dumLayer = core.QgsVectorLayer("Point?crs=EPSG:4326", "temporary_points", "memory") self.actualPOV = {"lat":0.0,"lon":0.0,"heading":0.0,"zoom":1} self.pointWgs84 = None self.mkDirs() self.licenceDlg = snapshotLicenseDialog() self.httpConnecting = None self.S = QtCore.QSettings() terms = self.S.value("go2sv/license", defaultValue = "undef") self.APIkey = self.S.value("go2sv/APIkey", defaultValue = "") self.licenceDlg.APIkey.setText(self.APIkey) if terms == self.version: self.licenseAgree = True self.licenceDlg.checkGoogle.setCheckState(QtCore.Qt.Checked) self.licenceDlg.checkGoogle.setEnabled(False) else: self.licenseAgree = None self.licenceDlg.OKbutton.clicked.connect(self.checkLicenseAction) self.licenceDlg.textBrowser.anchorClicked.connect(self.openExternalUrl) # Register plugin layer type #self.tileLayerType = TileLayerType(self) #QgsPluginLayerRegistry.instance().addPluginLayerType(self.tileLayerType) self.view.SV.page().setNetworkAccessManager(core.QgsNetworkAccessManager.instance()) self.view.BE.page().setNetworkAccessManager(core.QgsNetworkAccessManager.instance()) #setting a webinspector dialog self.webInspectorDialog = QtWidgets.QDialog() self.webInspector = QtWebKitWidgets.QWebInspector(self.webInspectorDialog) self.webInspector.setPage(self.view.BE.page()) self.webInspectorDialog.setLayout(QtWidgets.QVBoxLayout()) self.webInspectorDialog.setWindowTitle("Web Inspector") self.webInspectorDialog.resize(960, 480) self.webInspectorDialog.layout().addWidget(self.webInspector) self.webInspectorDialog.setModal(False) self.webInspectorDialog.hide() core.QgsExpression.registerFunction(get_streetview_url) core.QgsExpression.registerFunction(get_streetview_pov)