Пример #1
0
    def stack_details(self):
        page_css = '''background-color: #2D2D2D; color: #ffffff;'''

        ################################################################################################################
        # page1
        ################################################################################################################
        self.page_1.setStyleSheet(page_css)
        self.page_1_layout = QVBoxLayout(self)

        self.anime = QWebEngineView()
        self.anime.setUrl(QUrl("https://animixplay.to"))

        self.page_1_layout.addWidget(self.anime)

        self.page_1.setLayout(self.page_1_layout)

        ################################################################################################################
        # page 2
        ################################################################################################################
        self.page_2.setStyleSheet(page_css)
        self.page_2_layout = QVBoxLayout(self)

        self.manga_read = QWebEngineView()
        self.manga_read.setUrl(QUrl("https://manganelo.com"))

        self.page_2_layout.addWidget(self.manga_read)

        self.page_2.setLayout(self.page_2_layout)
Пример #2
0
 def __init__(self, filename, parent=None):
     super(LocationWidget, self).__init__(parent)
     self.temp_dir = QTemporaryDir()
     if self.temp_dir.isValid():
         with exiftool.ExifTool(exiftool_exe()) as et:
             try:
                 metadata = et.get_metadata(filename)
                 lat = metadata["Composite:GPSLatitude"]
                 lon = metadata["Composite:GPSLongitude"]
             except KeyError:
                 label = QLabel(self.tr("Geolocation data not found!"))
                 modify_font(label, bold=True)
                 label.setStyleSheet("color: #FF0000")
                 label.setAlignment(Qt.AlignCenter)
                 layout = QVBoxLayout()
                 layout.addWidget(label)
                 self.setLayout(layout)
                 return
             url = f"https://www.google.com/maps/place/{lat},{lon}/@{lat},{lon},17z/" \
                   f"data=!4m5!3m4!1s0x0:0x0!8m2!3d{lat}!4d{lon}"
             web_view = QWebEngineView()
             web_view.load(QUrl(url))
             layout = QVBoxLayout()
             layout.addWidget(web_view)
             self.setLayout(layout)
Пример #3
0
    def __init__(self, settings=None):
        super(Py2WebBrowser, self).__init__()
        self.pwb = QWebEngineView()
        self.pwb.setAttribute(Qt.WA_DeleteOnClose, True)

        if settings is not None:
            self.bconf = settings
        else:
            self.bconf = BaseConfig()

        self.raw_cookies = []
        self.cookie_list = []

        self.req_obj = QWebEngineHttpRequest()

        profile = QWebEngineProfile("pyweb", self.pwb)
        profile.setHttpUserAgent(random.choice(self.bconf.USER_AGENT_LIST))
        cookie_store = profile.cookieStore()

        cookie_store.cookieAdded.connect(self._on_cookie)

        wp = QWebEnginePage(profile, self.pwb)
        self.pwb.setPage(wp)

        self._settings()
        self.pwb.show()
Пример #4
0
 def __init__(self, filename, parent=None):
     super(LocationWidget, self).__init__(parent)
     self.temp_dir = QTemporaryDir()
     if self.temp_dir.isValid():
         with exiftool.ExifTool(exiftool_exe()) as et:
             temp_file = os.path.join(self.temp_dir.path(), "geo.html")
             metadata = et.get_metadata(filename)
             try:
                 lat = metadata["Composite:GPSLatitude"]
                 long = metadata["Composite:GPSLongitude"]
             except KeyError:
                 label = QLabel(self.tr("Geolocation data not found!"))
                 modify_font(label, bold=True)
                 label.setStyleSheet("color: #FF0000")
                 label.setAlignment(Qt.AlignCenter)
                 layout = QVBoxLayout()
                 layout.addWidget(label)
                 self.setLayout(layout)
                 return
             html = '<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2948.532014673314!2d{}!3d{}!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2zNDLCsDIxJzA5LjAiTiA3McKwMDUnMjguMiJX!5e0!3m2!1sit!2sit!4v1590074026898!5m2!1sit!2sit" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>'.format(
                 long, lat)
             with open(temp_file, "w") as file:
                 file.write(html)
             web_view = QWebEngineView()
             web_view.load(QUrl("file://" + temp_file))
             layout = QVBoxLayout()
             layout.addWidget(web_view)
             self.setLayout(layout)
Пример #5
0
    def __init__(self):
        super(ManualWindow, self).__init__()

        self.setWindowTitle('QAX Manual')

        icon_info = QFileInfo(app_info.app_icon_path)
        self.setWindowIcon(QIcon(icon_info.absoluteFilePath()))

        self.toolbar = QToolBar()
        self.addToolBar(self.toolbar)
        self.back_button = QPushButton()
        self.back_button.setIcon(qta.icon('fa.arrow-left'))
        self.back_button.clicked.connect(self.back)
        self.toolbar.addWidget(self.back_button)
        self.forward_button = QPushButton()
        self.forward_button.setIcon(qta.icon('fa.arrow-right'))
        self.forward_button.clicked.connect(self.forward)
        self.toolbar.addWidget(self.forward_button)

        self.address_line_edit = QLineEdit()
        self.address_line_edit.returnPressed.connect(self.load)
        self.address_line_edit.setVisible(False)
        self.toolbar.addWidget(self.address_line_edit)

        self.web_engine_view = QWebEngineView()
        self.web_engine_view.setZoomFactor(2.0)
        self.setCentralWidget(self.web_engine_view)
        initialUrl = self.docs_url()

        self.address_line_edit.setText(str(initialUrl))
        self.web_engine_view.load(QUrl(initialUrl))
        self.web_engine_view.page().urlChanged.connect(self.urlChanged)
Пример #6
0
    def __init__(self, parent=None, caption="", url=""):
        super(WebDialog, self).__init__(parent)

        self.url = url

        self.setWindowTitle(caption)
        self.setMinimumWidth(600)
        self.setMinimumHeight(500)

        vLayout = QVBoxLayout()
        self.setLayout(vLayout)

        self.page = MyQWebEnginePage()
        self.browser = QWebEngineView(self)
        self.browser.setPage(self.page)
        vLayout.addWidget(self.browser)

        # Buttons
        hLayout = QHBoxLayout()
        vLayout.addLayout(hLayout)
        hLayout.addStretch(5)

        buttonDismiss = QPushButton(self)
        buttonDismiss.setText("Cancel")
        buttonDismiss.clicked.connect(self.reject)
        hLayout.addWidget(buttonDismiss)

        buttonProceed = QPushButton(self)
        buttonProceed.setText("Proceed")
        buttonProceed.setDefault(True)
        buttonProceed.clicked.connect(self.accept)
        hLayout.addWidget(buttonProceed)

        self.loadPage()
Пример #7
0
    def __init__(self,
                 client_id='42e8e8e9d844e45c2d05',
                 hint_username=None,
                 parent=None):
        super(QGithubDeviceAuthDialog, self).__init__(parent=parent)
        self.setWindowTitle('Log into your GitHub account and enter this code')

        self.__webview = QWebEngineView(parent=self)
        self.__webview.setSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
        self.__webview.urlChanged.connect(self.on_url_changed)

        self.__infolaabel = QLabel(
            '<p style="font-size:14px">'
            '<br>You need to allow hpaste to modify your gists on github. for that you need to log in to your account and authorize hpaste.\n'
            '<br>You can do it in <b>any</b> browser, not only in this window. Just go to <a href="https://github.com/login/device">https://github.com/login/device</a> and enter the code below.\n'
            '<br>close this window when you are done'
            '</p>',
            parent=self)
        self.__infolaabel.setTextFormat(Qt.RichText)
        self.__infolaabel.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.__infolaabel.setOpenExternalLinks(True)
        self.__devidlabel = QLabel(parent=self)
        self.__devidlabel.setTextInteractionFlags(Qt.TextBrowserInteraction)
        ff = self.__devidlabel.font()
        ff.setPointSize(64)
        self.__devidlabel.setFont(ff)

        self.__reload_button = QPushButton('log in to a different account',
                                           parent=self)
        self.__reload_button.clicked.connect(self.reload_button_clicked)

        self.__layout = QVBoxLayout()
        self.setLayout(self.__layout)
        self.__layout.addWidget(self.__infolaabel)
        self.__layout.addWidget(self.__devidlabel)
        self.__layout.addWidget(self.__reload_button)
        self.__layout.addWidget(self.__webview)
        self.__result = None

        # self.setGeometry(512, 256, 1024, 768)
        self.resize(1024, 860)

        # init auth process
        self.__client_id = client_id
        self.__headers = {
            'User-Agent': 'HPaste',
            'Accept': 'application/json',
            'charset': 'utf-8',
            'Content-Type': 'application/json'
        }
        self.__hint_username = hint_username

        self.__webprofile = None
        self.__webpage = None

        self.__device_code = None
        self.__interval = None
        self.__await_login_redirect = False
        self.reinit_code()
Пример #8
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle('PySide2 WebEngineWidgets Example')

        self.toolBar = QToolBar()
        self.addToolBar(self.toolBar)
        self.backButton = QPushButton()
        self.backButton.setIcon(
            QIcon(':/qt-project.org/styles/commonstyle/images/left-32.png'))
        self.backButton.clicked.connect(self.back)
        self.toolBar.addWidget(self.backButton)
        self.forwardButton = QPushButton()
        self.forwardButton.setIcon(
            QIcon(':/qt-project.org/styles/commonstyle/images/right-32.png'))
        self.forwardButton.clicked.connect(self.forward)
        self.toolBar.addWidget(self.forwardButton)

        self.addressLineEdit = QLineEdit()
        self.addressLineEdit.returnPressed.connect(self.load)
        self.toolBar.addWidget(self.addressLineEdit)

        self.webEngineView = QWebEngineView()
        self.setCentralWidget(self.webEngineView)
        initialUrl = 'http://qt.io'
        self.addressLineEdit.setText(initialUrl)
        self.webEngineView.load(QUrl(initialUrl))
        self.webEngineView.page().titleChanged.connect(self.setWindowTitle)
        self.webEngineView.page().urlChanged.connect(self.urlChanged)
Пример #9
0
 def __init__(self):
     super(Visual, self).__init__()
     self.browser = QWebEngineView()
     self.browser.load(QUrl("www.baidu.com"))
     layout = QVBoxLayout()
     layout.addWidget(self.browser)
     self.setLayout(layout)
Пример #10
0
 def __init__(self, parent, name, view):
     QWidget.__init__(self, parent)
     DockContextHandler.__init__(self, self, name)
     layout = QGridLayout(self)
     webview = QWebEngineView()
     webview.load("https://cloud.binary.ninja")
     layout.addWidget(webview, 0, 0)
Пример #11
0
def webkit_download(url):
    app = QApplication([])
    webview = QWebEngineView()
    webview.loadFinished.connect(app.quit)
    webview.load(url)
    app.exec_() # delay here until download finished
    return webview.page().mainFrame().toHtml()
Пример #12
0
 def __init__(self):
     super().__init__()
     self.setWindowTitle('Ayuda de la aplicación de cobro de Clean Market')
     self.navegador = QWebEngineView()
     vbox = QVBoxLayout()
     vbox.addWidget(self.navegador)
     self.setLayout(vbox)
Пример #13
0
 def __init__(self, parent=None):
     super(EditorWidget, self).__init__(parent)
     web_view = QWebEngineView()
     web_view.load(QUrl('https://hexed.it/'))
     layout = QVBoxLayout()
     layout.addWidget(web_view)
     self.setLayout(layout)
Пример #14
0
    def __init__(self, parent):
        """Description of this module."""
        super().__init__()
        self.parent = parent
        self.name = "Profile"

        self.html = QWebEngineView()

        self.bt_close = QPushButton('Close')
        self.bt_close.setIcon(self.style().standardIcon(
            QStyle.SP_DialogCloseButton))
        self.bt_close.clicked.connect(lambda: self.parent.close_tab_top(self))

        self.bt_maxfig = QPushButton('Expand / Retract')
        self.bt_maxfig.setIcon(self.style().standardIcon(
            QStyle.SP_TitleBarMaxButton))
        self.bt_maxfig.clicked.connect(self.parent.toggle_max_figure)

        self.grid1 = QGridLayout()
        self.grid1.setColumnStretch(0, 1)
        self.grid1.addWidget(QWidget(), 0, 0, 1, 3)
        self.grid1.addWidget(self.bt_maxfig, 0, 4, 1, 1)
        self.grid1.addWidget(self.bt_close, 0, 5, 1, 1)

        self.vbox = QVBoxLayout()
        self.vbox.addLayout(self.grid1)
        self.vbox.addWidget(self.html)
        self.setLayout(self.vbox)
Пример #15
0
    def __init__(
        self,
        notebook_generator: "NotebookProjectGenerator",
        project_manager: "ProjectManagerGUI",
        parent: "QWidget" = None,
    ):
        super().__init__(parent)

        # Components
        self._project_manager = project_manager
        self._notebook_generator = notebook_generator

        self._project_manager.active_project_changed.connect(self._set_active_project)

        # Widgets
        self._text_browser = QWebEngineView()
        self._text_browser.show()

        self._generate_notebook_button = QPushButton("Generate Notebook")
        self._generate_notebook_button.clicked.connect(self._generate_html)

        # Layout
        self._main_layout = QVBoxLayout()
        self._main_layout.setContentsMargins(0, 0, 0, 0)
        self._main_layout.addWidget(self._text_browser)
        self._main_layout.addWidget(self._generate_notebook_button)

        self.setLayout(self._main_layout)

        # Set active project and generate notebook
        self._set_active_project(self._project_manager.active)
Пример #16
0
def main():
    app = QApplication(sys.argv)
    #shared= QSharedMemory("wepush")
    #if shared.attach():
    #return 0
    #shared.create(1)

    #sys.stdout=common.Mystd()

    loop = QEventLoop(app)
    asyncio.set_event_loop(loop)

    win = QWebEngineView()  # QWebEngineView()
    director['root_win'] = win
    #thread.start_new_thread (server.start_server,(28289,))
    #win =QWebView()
    #win.setWindowIcon(QIcon( './html/wechat.ico'))
    win.setMinimumSize(1200, 900)
    win.setWindowTitle('微信群发工具V1.0')
    url = 'file:///%s/test.html' % base_dir.replace('\\', '/')
    win.load(QUrl(url))
    win.show()

    with loop:
        from server import start_server
        #loop.set_debug(True)
        loop.run_until_complete(start_server)
        #loop.create_task(send())
        #loop.create_task(start_server)

        loop.run_forever()
Пример #17
0
 def __init__(self, view):
     super(Page, self).__init__()
     self.parent = view.parent
     self.view = view
     self.result = None
     self.fullView = QWebEngineView()
     self.exitFSAction = QAction(self.fullView)
     self.loop = None
Пример #18
0
 def set_analyzed_license_tab(self):
     self.remove_analyzed_license_tabs()
     parsedWebEngineView = QWebEngineView()
     with open("response.html", "r") as response_file:
         parsedWebEngineView.setHtml(response_file.read())
     self.ui.licenseTabWidget.addTab(parsedWebEngineView,
                                     "Analyzed License")
     self.ui.licenseTabWidget.setCurrentIndex(1)
Пример #19
0
def render(html: bytes, filename: str):
    page = QWebEngineView()
    # printer = QPrinter()
    # printer.setOutputFileName('/mnt/data/test.pdf')
    page.loadFinished.connect(lambda self: print_pdf(page, filename))
    page.setHtml(html, QUrl('file://'))

    app.exec_()
Пример #20
0
 def __init__(self):
     super().__init__()
     self.webView = QWebEngineView()
     layout = QGridLayout()
     layout.addWidget(self.webView, 0, 0)
     self.setLayout(layout)
     self.json_data = ''
     self.plot_type = 'Regressão'
     self.webView.page().profile().downloadRequested.connect(self.download_handler)
Пример #21
0
    def __init__(self):
        super().__init__()

        self.browser = QWebEngineView()
        self.browser.setUrl(QUrl("https://www.google.com"))

        self.setCentralWidget(self.browser)

        self.show()
Пример #22
0
    def __init__(self, container):
        QWidget.__init__(self, container)
        PageSignal.changed.connect(self.render)
        self.view = QWebEngineView()

        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.view)

        self.setLayout(self.layout)
Пример #23
0
    def __init__(self):
        QWidget.__init__(self)

        self.webView = QWebEngineView()
        self.webView.load("https://www.messenger.com/login")

        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.webView)
        self.setLayout(self.layout)
Пример #24
0
    def __controls(self):

        path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            "test2.html")
        print(path)
        #html = open('test2.html', 'r').read()
        self.browser = QWebEngineView()
        self.browser.setPage(WebPage(self.browser))
        #self.browser.load(QUrl.fromLocalFile(path))
        self.browser.load(QUrl("http://localhost:5000"))
Пример #25
0
def test():
    url = 'https://github.com/tody411/PyIntroduction'

    #QCoreApplication.setAttribute()
    app = QApplication(sys.argv)
    browser = QWebEngineView()
    browser.load(QUrl(url))
    browser.resize(1024, 750)
    browser.show()

    sys.exit(app.exec_())
Пример #26
0
    def __init__(self, log_console):
        logger.debug(locals())
        QWidget.__init__(self)
        log_console.add_loggers(logger)

        self.graph = None
        self.webview = QWebEngineView(parent=self)
        self.index = QWebEnginePage(self)

        worklayout = QHBoxLayout(parent=self)
        worklayout.addWidget(self.webview)
        self.setLayout(worklayout)
Пример #27
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)
        layout = QtWidgets.QVBoxLayout()
        view = QWebEngineView()
        layout.addWidget(view)
        self.setLayout(layout)
        self.resize(900, 600)

        url = 'file://' + os.path.join(
            pathlib.Path(__file__).parent.absolute(), 'index.html')
        print(url)
        view.load(QUrl(url))
Пример #28
0
    def __init__(self, url, success_re, parent=None):
        super(QWebAuthDialog, self).__init__(parent=parent)

        self.__webview = QWebEngineView(parent=self)
        self.__webview.load(QUrl(url))
        self.__succre = re.compile(success_re)
        self.__webview.urlChanged.connect(self.on_url_changed)

        self.__layout = QVBoxLayout()
        self.setLayout(self.__layout)
        self.__layout.addWidget(self.__webview)
        self.__result = None
Пример #29
0
    def initUI(self):
        mainLayout = QVBoxLayout()
        self.setLayout(mainLayout)

        self.webview = QWebEngineView()
        self.webpage = QWebEnginePage()
        self.webview.setPage(self.webpage)
        url = QUrl.fromLocalFile(
            resource_filename("yaogua", "html_resource/zhou_yi_yao_gua.html"))
        self.webview.load(url)

        mainLayout.addWidget(self.webview)
Пример #30
0
 def test_SchemeHandlerRedirect(self):
     app = QApplication([])
     handler = TestSchemeHandler()
     profile = QWebEngineProfile.defaultProfile()
     profile.installUrlSchemeHandler("testpy", handler)
     view = QWebEngineView()
     view.loadFinished.connect(app.quit)
     QTimer.singleShot(5000, app.quit)
     view.show()
     view.load("testpy:hello")
     app.exec_()
     self.assertEqual(view.url(), "testpy:goodbye")