Esempio n. 1
0
    def serve_forever(self):
        self.jid = 'Err@localhost'
        self.connect()  # be sure we are "connected" before the first command
        self.connect_callback()  # notify that the connection occured

        # create window and components
        app = QtGui.QApplication(sys.argv)
        self.mainW = QtGui.QWidget()
        self.mainW.setWindowTitle('Err...')
        icon_path = os.path.dirname(errbot.__file__) + os.sep + 'err.svg'
        bg_path = os.path.dirname(errbot.__file__) + os.sep + 'err-bg.svg'
        self.mainW.setWindowIcon(QtGui.QIcon(icon_path))
        vbox = QtGui.QVBoxLayout()
        help = QtGui.QLabel(
            "CTRL+Space to autocomplete -- CTRL+Enter to send your message")
        self.input = CommandBox(self.cmd_history, self.commands)
        self.output = QtWebKit.QWebView()

        # init webpage
        self.buffer = """<html>
                           <head>
                                <link rel="stylesheet" type="text/css" href="%s/style/style.css" />
                           </head>
                           <body style=" background-image: url('%s'); background-repeat: no-repeat; background-position:center center; background-attachment:fixed; background-size: contain; margin:0;">
                           """ % (QUrl.fromLocalFile(BOT_DATA_DIR).toString(),
                                  QUrl.fromLocalFile(bg_path).toString())
        self.output.setHtml(self.buffer)

        # layout
        vbox.addWidget(self.output)
        vbox.addWidget(self.input)
        vbox.addWidget(help)
        self.mainW.setLayout(vbox)

        # setup web view to open liks in external browser
        self.output.page().setLinkDelegationPolicy(
            QtWebKit.QWebPage.DelegateAllLinks)

        # connect signals/slots
        self.output.page().mainFrame().contentsSizeChanged.connect(
            self.scroll_output_to_bottom)
        self.output.page().linkClicked.connect(QtGui.QDesktopServices.openUrl)
        self.input.newCommand.connect(self.send_command)
        self.conn.newAnswer.connect(self.new_message)

        self.mainW.show()
        try:
            app.exec_()
        finally:
            self.disconnect_callback()
            self.shutdown()
            exit(0)
Esempio n. 2
0
    def __init__(self):
        QtGui.QDialog.__init__(self)

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.webView = QtWebKit.QWebView()
        self.webView.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.layout.addWidget(self.webView, 0, 0, 1, 2)  #3,2

        #page = WebPage()
        #self.webView.setPage(page)
        self.webView.load(QtCore.QUrl("./resources/manuel/index.html"))
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1000, 700)
        self.centralWidget = QtGui.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.webView = QtWebKit.QWebView(self.centralWidget)
        self.webView.settings().setAttribute(
            QtWebKit.QWebSettings.PluginsEnabled, True)
        self.webView = QtWebKit.QWebView(self.centralWidget)
        self.webView.setGeometry(QtCore.QRect(10, 20, 1000, 700))

        fn = os.path.join(os.path.dirname(__file__), 'guia')

        url = fn + "/guia_usuario.html"
        print(url)
        self.webView.load(QUrl(url))
        # QtGui.QDesktopServices.openUrl(url)
        self.webView.setObjectName("webView")
        MainWindow.setCentralWidget(self.centralWidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Esempio n. 4
0
	def __init__(self,url,title='Help'):
		super().__init__()
		self.view = QtWebKit.QWebView(self)
		self.view.load(url)

		self.layout = QtGui.QHBoxLayout()
		self.layout.addWidget(self.view)
		self.setWindowIcon(QtGui.QIcon('icons/windows_icon.ico'))

		self.setLayout(self.layout)
		self.resize(800,600)
		self.setWindowTitle(title)
		self.show()
Esempio n. 5
0
    def __init__(self, parent=None):
        super(HelpFormSphinx, self).__init__(parent)

        self.parent = parent

        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.setModal(0)

        self.setWindowTitle("Atoman Help")
        self.setWindowIcon(QtGui.QIcon(iconPath("oxygen/help-browser.png")))

        self.helpFormOpen = False

        # browser
        self.webView = QtWebKit.QWebView(self)

        # toolbar actions
        backAction = QtGui.QAction(
            QtGui.QIcon(iconPath("oxygen/go-previous.png")), "&Back", self)
        backAction.triggered.connect(self.webView.back)
        homeAction = QtGui.QAction(QtGui.QIcon(iconPath("oxygen/go-home.png")),
                                   "&Home", self)
        homeAction.triggered.connect(
            functools.partial(self.loadPage, "index.html"))
        forwardAction = QtGui.QAction(
            QtGui.QIcon(iconPath("oxygen/go-next.png")), "&Foward", self)
        forwardAction.triggered.connect(self.webView.forward)

        # tool bar
        toolbar = QtGui.QToolBar()
        toolbar.setFixedHeight(50)
        toolbar.addAction(backAction)
        toolbar.addAction(homeAction)
        toolbar.addAction(forwardAction)

        logger = logging.getLogger(__name__)
        self.logger = logger
        logger.debug("Setting up help form")

        self.loadPage("index.html")
        self.webView.show()

        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(toolbar)
        layout.addWidget(self.webView)

        self.resize(950, 700)
Esempio n. 6
0
  def __init__(self,theParent=None):
    QtGui.QDialog.__init__(self,theParent)
    self.m_FileName = None

    aLayout = QtGui.QVBoxLayout()

    aTabLayout = QtGui.QHBoxLayout()
    aToolBar = self.createToolBar()

    aTabLayout.addWidget(aToolBar)

    aSplitter = QtGui.QSplitter(self)

    aTabWidget = QtGui.QTabWidget(self)

    aBasicTab = self.createGeneralPanel(aTabWidget)
    aTabWidget.addTab(aBasicTab,self.tr("General")) 

    anEnclosureStandPanel = self.createEnclosureStandPanel(aTabWidget)
    aTabWidget.addTab(anEnclosureStandPanel,self.tr("Enclosure stands")) 

    self.m_CustomStandsWidget = CustomStandsWidget(self)
    aTabWidget.addTab(self.m_CustomStandsWidget,self.tr("Custom stands")) 
    
    self.m_LeftPanelWidget = EnclosurePanelWidget(self.tr("Create panel"),aTabWidget)   
    aTabWidget.addTab(self.m_LeftPanelWidget,self.tr("Left panel")) 

    self.m_RightPanelWidget = EnclosurePanelWidget(self.tr("Create panel"),aTabWidget)   
    aTabWidget.addTab(self.m_RightPanelWidget,self.tr("Right panel")) 

    self.m_FrontPanelWidget = EnclosurePanelWidget(self.tr("Create panel"),aTabWidget)   
    aTabWidget.addTab(self.m_FrontPanelWidget,self.tr("Front panel")) 

    self.m_BackPanelWidget = EnclosurePanelWidget(self.tr("Create panel"),aTabWidget)   
    aTabWidget.addTab(self.m_BackPanelWidget,self.tr("Back panel")) 

    aSplitter.addWidget(aTabWidget)

    self.m_HelpWdg = QtWebKit.QWebView(self)
    self.m_HelpWdg.load(QtCore.QUrl("http://www.google.com"))
    aSplitter.addWidget(self.m_HelpWdg)
    aTabLayout.addWidget(aSplitter)

    aLayout.addLayout(aTabLayout)
    aDlgBtns = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Cancel)
    aDlgBtns.accepted.connect(self.accept)
    aDlgBtns.rejected.connect(self.reject)
    aLayout.addWidget(aDlgBtns)
    self.setLayout(aLayout)
    self.setTitle()
    self.onHelp()
Esempio n. 7
0
 def print(self, filename):
     print(filename)
     self.filename = filename
     self.printer = QtGui.QPrinter()
     self.printer.setPageSize(QtGui.QPrinter.A4)
     self.printer.setColorMode(QtGui.QPrinter.Color)
     self.printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
     self.printer.setOutputFileName(filename)
     self.page = QtWebKit.QWebPage(self.parent())
     self.page.mainFrame().load("file://%s" % self.url)
     self.view = QtWebKit.QWebView()
     self.view.setPage(self.page)
     #self.view.show()
     self.page.mainFrame().loadFinished.connect(self.print_)
Esempio n. 8
0
    def WidgetsParte2_5(self):

        self.barra_de_navegacion = QtGui.QLineEdit()
        self.navegador = QtWebKit.QWebView()
        self.barra_de_navegacion.returnPressed.connect(self.ir_a_pagina)

        self.vbox = QtGui.QVBoxLayout()
        self.vbox.addWidget(self.barra_de_navegacion)
        self.vbox.addWidget(self.navegador)
        self.setLayout(self.vbox)

        self.setGeometry(300, 50, 900, 650)
        self.setWindowTitle('Ejemplo de widget N°5')
        self.show()
Esempio n. 9
0
    def __init__(self, home_url, icon_provider):
        super().__init__()

        # store home url
        self.home_url = home_url

        # create and add tool bar on top (non floatable or movable)
        tool_bar = QtGui.QToolBar(self)

        # create actions, connect to methods, add to tool bar
        action_home = QtGui.QAction(self)
        action_home.setIcon(icon_provider('icon.home.png'))
        action_home.setToolTip('Home')
        action_home.triggered.connect(self.actionHomeTriggered)
        tool_bar.addAction(action_home)

        action_backward = QtGui.QAction(self)
        action_backward.setEnabled(False)
        action_backward.setIcon(icon_provider('icon.backward.png'))
        action_backward.triggered.connect(self.actionBackwardTriggered)
        tool_bar.addAction(action_backward)
        self.action_backward = action_backward

        action_forward = QtGui.QAction(self)
        action_forward.setEnabled(False)
        action_forward.setIcon(icon_provider('icon.forward.png'))
        action_forward.triggered.connect(self.actionForwardTriggered)
        tool_bar.addAction(action_forward)
        self.action_forward = action_forward

        # create and add web view, connect linkClicked signal with our newPage method
        web_view = QtWebKit.QWebView()
        # must set DelegationPolicy to include all links
        web_view.page().setLinkDelegationPolicy(
            QtWebKit.QWebPage.DelegateAllLinks)
        web_view.linkClicked.connect(self.newPage)
        self.web_view = web_view

        # set Layout
        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(tool_bar)
        layout.addWidget(web_view)

        # Initialize history (initially there is no current page)
        self.history = []
        self.current_page_index = -1

        # Finally set the home page
        self.actionHomeTriggered()
Esempio n. 10
0
    def _createEditor(self):
        #Group box for editor and its label
        editorGroup = QtGui.QGroupBox()
        #create the layout
        layout = QtGui.QGridLayout()
        #create the model
        self.model = QtGui.QStringListModel()
        self.model.setStringList([""] * 20)
        #create the editor
        self.editor = TableView()
        self.editor.setModel(self.model)
        #create the label for editor
        editorLabel = QtGui.QLabel("MARKDOWN")
        self.infoLabel = QtGui.QLabel()
        # add the label and editor to layout
        layout.addWidget(editorLabel, 0, 0)
        layout.addWidget(self.editor, 1, 0)
        layout.addWidget(self.infoLabel, 2, 0)
        #set layout to the editorGroup
        editorGroup.setLayout(layout)

        #Group box for preview
        previewGroup = QtGui.QGroupBox()
        #create the layout
        layout = QtGui.QGridLayout()
        #create the webView widget for preview
        self.webView = QtWebKit.QWebView()
        #create the label, the button for the webView
        webViewLabel = QtGui.QLabel("PREVIEW")
        button = QtGui.QToolButton()
        button.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap("icon.png").scaled(
                    50, 50, aspectMode=QtCore.Qt.KeepAspectRatio)))
        #button.setFlat(True)
        self.webSaveLabel = QtGui.QLabel("Autosave in %s" % os.getcwd())
        self.webSaveLabel.setAlignment(QtCore.Qt.AlignHCenter)
        # set the label, button and preview to the layout
        layout.addWidget(webViewLabel, 0, 0)
        layout.addWidget(button, 0, 1)
        layout.addWidget(self.webView, 1, 0, 1, 2)
        layout.addWidget(self.webSaveLabel, 2, 0, 1, 2)
        #set layout to the previewGroup
        previewGroup.setLayout(layout)

        # we need a horizontal layout to contain both editorGroup and previewGroup
        group = QtGui.QHBoxLayout()
        group.addWidget(editorGroup)
        group.addWidget(previewGroup)
        return group
Esempio n. 11
0
    def __init__(self, parent):
        super(PixelatedWindow, self).__init__(parent)
        self.view = QtWebKit.QWebView(self)

        layout = QtGui.QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.view)
        self.setLayout(layout)
        self.setWindowTitle('Bitmask Mail')

        # For the moment, we need to resize to a sensible default to avoid the
        # "send" button to be out of view in the compose pane. This should be
        # removed as soon as pixelated becomes size-responsive.
        self.resize(800, 700)
Esempio n. 12
0
    def initUI(self):
        self.log.info("Starting UI init of %s" % self.__class__.__name__)
        self.layout().setDirection(QtGui.QBoxLayout.LeftToRight)

        # Left hand side: html window
        self.web = QtWebKit.QWebView(self)

        # Set the css file. Note that the path to the css needs to be absolute,
        # somehow...
        path = os.path.abspath(os.path.dirname(__file__))
        self.css = os.path.join(path, 'assets', 'style', 'default.css')
        self.web.settings().setUserStyleSheetUrl(
            QtCore.QUrl.fromLocalFile(self.css))

        # The 1 stands for a stretch factor, set to 0 by default (seems to be
        # only for QWebView, though...
        self.layout().addWidget(self.web, 1)

        # Right hand side: Vertical layout for the tags inside a QScrollArea
        scrollArea = QtGui.QScrollArea()
        scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        scrollArea.verticalScrollBar().setFocusPolicy(QtCore.Qt.StrongFocus)

        # Need to create a dummy Widget, because QScrollArea can not accept a
        # layout, only a Widget
        dummy = QtGui.QWidget()
        # Limit its width
        dummy.setFixedWidth(200)

        vbox = QtGui.QVBoxLayout()
        self.tagButtons = []
        if self.extracted_tags:
            for key, value in six.iteritems(self.extracted_tags):
                tag = QtGui.QPushButton(key)
                tag.setFlat(False)
                tag.setMinimumSize(100, 40 + 5 * value)
                tag.setMaximumWidth(165)
                tag.setCheckable(True)
                tag.clicked.connect(self.addFilter)
                self.tagButtons.append([key, tag])
                vbox.addWidget(tag)
        # Adding everything to the scroll area
        dummy.setLayout(vbox)
        scrollArea.setWidget(dummy)

        self.layout().addWidget(scrollArea)

        # Logging
        self.log.info("Finished UI init of %s" % self.__class__.__name__)
Esempio n. 13
0
 def createWebView(self, port=1080):
     """
     This webView ignores all SSL errors
     :rtype : QtWebKit.QWebView
     """
     w = QtWebKit.QWebView()
     nam = w.page().networkAccessManager()
     assert isinstance(nam, QtNetwork.QNetworkAccessManager)
     proxy = QtNetwork.QNetworkProxy()
     proxy.setType(QtNetwork.QNetworkProxy.HttpProxy)
     proxy.setHostName("127.0.0.1")
     proxy.setPort(port)
     nam.setProxy(proxy)
     nam.sslErrors.connect(self.sslErrorHandler)
     return w
def main():  
    app = QtGui.QApplication(sys.argv)  
  
    myObj = StupidClass()  
  
    webView = QtWebKit.QWebView()  
    # Make myObj exposed as JavaScript object named 'pyObj'  
    webView.page().mainFrame().addToJavaScriptWindowObject("pyObj", myObj)  
    webView.setHtml(html)  
  
    window = QtGui.QMainWindow()  
    window.setCentralWidget(webView)  
    window.show()  
  
    sys.exit(app.exec_())  
    def __init__(self):
        super(ClientInterface, self).__init__()

        # ui layout
        self.main_layout = QtGui.QGridLayout()
        # menu_bar
        self.menu_bar = QtGui.QMenuBar(self)
        self.menu_bar.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        # web_app
        self.web_app = QtWebKit.QWebView(self)
        self.web_app.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        # init filename
        self.file_name = None
        self.dataset = None
Esempio n. 16
0
    def __init__(self, bot):
        self.bot = bot
        super().__init__(sys.argv)
        self.mainW = QtGui.QWidget()
        self.mainW.setWindowTitle('Errbot')
        self.mainW.setWindowIcon(QtGui.QIcon(icon_path))
        vbox = QtGui.QVBoxLayout()
        help_label = QtGui.QLabel(
            "ctrl or alt+space for autocomplete -- ctrl or alt+Enter to send your message"
        )
        self.input = CommandBox(bot.cmd_history[str(bot.user)],
                                bot.all_commands, bot.bot_config.BOT_PREFIX)
        self.demo_mode = hasattr(
            bot.bot_config, 'TEXT_DEMO_MODE') and bot.bot_config.TEXT_DEMO_MODE
        font = QtGui.QFont("Arial", QtGui.QFont.Bold)
        font.setPointSize(30 if self.demo_mode else 15)
        self.input.setFont(font)

        self.output = QtWebKit.QWebView()
        css = demo_css_path if self.demo_mode else css_path
        self.output.settings().setUserStyleSheetUrl(
            QtCore.QUrl.fromLocalFile(css))

        # init webpage
        self.buffer = ""
        self.update_webpage()

        # layout
        vbox.addWidget(self.output)
        vbox.addWidget(self.input)
        vbox.addWidget(help_label)
        self.mainW.setLayout(vbox)

        # setup web view to open liks in external browser
        self.output.page().setLinkDelegationPolicy(
            QtWebKit.QWebPage.DelegateAllLinks)

        # connect signals/slots
        self.output.page().mainFrame().contentsSizeChanged.connect(
            self.scroll_output_to_bottom)
        self.output.page().linkClicked.connect(QtGui.QDesktopServices.openUrl)
        self.input.newCommand.connect(lambda text: bot.send_command(text))
        self.newAnswer.connect(self.new_message)
        if self.demo_mode:
            self.mainW.showFullScreen()
        else:
            self.mainW.show()
Esempio n. 17
0
    def __init__(self):
        super().__init__(None)

        # Create console
        self._console = MonoSpaceTextEdit(self, relativesize=-2)
        self._console.setReadOnly(True)
        self._console.setMinimumSize(400, 100)
        self._console.setMaximumSize(400, 100)
        self._console.addPlainText('Console output\n')

        # Create buttons
        self._pullBut = QtGui.QPushButton('Pull source', self)
        self._pullBut.clicked.connect(self.onPull)
        self._generateBut = QtGui.QPushButton('Generate!', self)
        self._generateBut.clicked.connect(self.onGenerate)
        self._deployBut = QtGui.QPushButton('Deploy', self)
        self._deployBut.clicked.connect(self.onDeploy)
        #
        self._backBut = QtGui.QPushButton('Previous', self)
        self._refreshBut = QtGui.QPushButton('Refresh', self)

        # Create splitter
        self._splitter = QtGui.QSplitter(self)

        # Create list for source files and initialize
        self._sourceList = QtGui.QListWidget(self._splitter)
        self._sourceList.itemActivated.connect(self.onFileSelected)
        for fname in sorted(os.listdir(SOURCE_DIR)):
            if fname.endswith('.rst'):
                self._sourceList.addItem(fname)

        # Create editor to edit the source
        self._sourceEdit = MonoSpaceTextEdit(self._splitter)
        self._currentFile = None

        # Create html viewer
        self._htmlView = QtWebKit.QWebView(self._splitter)
        self._htmlView.setUrl(
            os.path.join(SOURCE_DIR, HTML_PAGES, 'index.html'))
        self._htmlView.setZoomFactor(0.8)

        # Connect some more signals
        self._backBut.clicked.connect(self._htmlView.back)
        self._refreshBut.clicked.connect(self._htmlView.reload)

        self._layout()
Esempio n. 18
0
    def __init__(self,
                 parent,
                 Title='Tutorial_Name',
                 TutorialBlob='Text Here',
                 TutorialVideo='Insert URL Here'):
        QtGui.QDialog.__init__(self)
        self.WindowLabel = Title
        videoView = QtWebKit.QWebView()
        videoURL = TutorialVideo
        videoView.load(QUrl(videoURL))
        videoView.show()

        layout = QtGui.QGridLayout()
        layout.addWidget(videoView, 0, 0)
        #        layout.addWidget(textBlobWindow,1,0)
        self.setWindowTitle(self.WindowLabel)
        self.setLayout(layout)
Esempio n. 19
0
    def __init__(self, csvSettings, parsedArgs):
        super(MeatBagWindow, self).__init__()
        self.setWindowTitle("Meat Bag Pick-n-Place v0.0000000003")

        self.efilter = filterObj(self)
        self.installEventFilter(self.efilter)

        self.initLayout()
        self.initMenus()
        if csvSettings:
            self.csv_settings = csvSettings
        else:
            self.csv_settings = MeatBagCSVSettingsAltium()

        self.getSettings()
        self.show()

        self.webView = QtWebKit.QWebView()
        self.webView.loadFinished.connect(self.lookupdone)

        self.last_keys = ""
        self.timerScan = QtCore.QTimer()
        self.timerScan.setSingleShot(True)
        self.timerScan.timeout.connect(self.timesUp)

        self.timerScanLineEdit = QtCore.QTimer()
        self.timerScanLineEdit.setSingleShot(True)
        self.timerScanLineEdit.timeout.connect(self.scanline_changed_dly)

        self.build_side = 0

        self.cur_placement = None
        self.drawing_all_same_value = False
        if parsedArgs is None:
            return
        # handle cmd line args
        if parsedArgs.image:
            self.pcbpainter.image_selected(parsedArgs.image)

        if parsedArgs.width and parsedArgs.height:
            self.pcbpainter.configure_pcb_dimensions(parsedArgs.height,
                                                     parsedArgs.width)

        if parsedArgs.csv:
            self.parseCSVFile(parsedArgs.csv)
Esempio n. 20
0
    def __init__(self, containerWidget):
        super(DebugInfo, self).__init__()

        self.setVisible(False)

        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.containerWidget = containerWidget
        # update FPS and render time very second
        self.boxUpdateInterval = 1

        self.ui = ceed.ui.ceguidebuginfo.Ui_CEGUIWidgetInfo()
        self.ui.setupUi(self)

        self.currentFPSBox = self.findChild(QtGui.QLineEdit, "currentFPSBox")
        self.currentRenderTimeBox = self.findChild(QtGui.QLineEdit,
                                                   "currentRenderTimeBox")

        self.errors = 0
        self.errorsBox = self.findChild(QtGui.QLineEdit, "errorsBox")

        self.warnings = 0
        self.warningsBox = self.findChild(QtGui.QLineEdit, "warningsBox")

        self.others = 0
        self.othersBox = self.findChild(QtGui.QLineEdit, "othersBox")

        self.logViewArea = self.findChild(QtGui.QWidget, "logViewArea")
        self.logViewAreaLayout = QtGui.QVBoxLayout()

        self.logView = QtWebKit.QWebView()
        self.logView.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                   QtGui.QSizePolicy.Ignored)
        self.logViewAreaLayout.addWidget(self.logView)

        self.logViewArea.setLayout(self.logViewAreaLayout)

        self.logMessagesLimit = settings.getEntry(
            "global/cegui_debug_info/log_limit").value
        self.logMessages = collections.deque([])

        self.containerWidget.ceguiInstance.logger.registerSubscriber(
            self.logEvent)
Esempio n. 21
0
    def __init__(self):
        # constructor de la clase
        super(Navegador, self).__init__(parent=None)
        self.setWindowTitle("Discovery")
        self.setWindowIcon(QtGui.QIcon('logo.png'))
        self.showMaximized()
        self.gridLayout = QtGui.QGridLayout(self)
        self.btnAtras = QtGui.QPushButton(self, text='<')
        self.gridLayout.addWidget(self.btnAtras, 0, 0, 1, 1)
        self.btnAdelante = QtGui.QPushButton(self, text='>')
        self.gridLayout.addWidget(self.btnAdelante, 0, 1, 1, 1)
        self.btnPagina = QtGui.QPushButton(self, text="Inicio")
        self.gridLayout.addWidget(self.btnPagina, 0, 4, 1, 1)
        self.btnRecargar = QtGui.QPushButton(self, text="Recargar")
        self.gridLayout.addWidget(self.btnRecargar, 0, 4, 1, 1)
        self.label = QtGui.QLabel(u"Introducir solo url", self)
        self.gridLayout.addWidget(self.label, 0, 2, 1, 1)
        self.txtUrl = QtGui.QLineEdit(self)
        self.gridLayout.addWidget(self.txtUrl, 0, 3, 1, 1)
        self.wvNavegador = QtWebKit.QWebView(self)
        self.gridLayout.addWidget(self.wvNavegador, 1, 0, 1, 5)

        QtNetwork.QNetworkProxyFactory.setUseSystemConfiguration(True)
        QtWebKit.QWebSettings.globalSettings().setAttribute(
            QtWebKit.QWebSettings.PluginsEnabled, True)
        QtWebKit.QWebSettings.globalSettings().setAttribute(
            QtWebKit.QWebSettings.JavascriptCanOpenWindows, True)
        QtWebKit.QWebSettings.globalSettings().setAttribute(
            QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)

        QtCore.QObject.connect(self.txtUrl, QtCore.SIGNAL("returnPressed()"),
                               self.cargarUrl)
        QtCore.QObject.connect(self.btnAtras, QtCore.SIGNAL("clicked()"),
                               self.wvNavegador.back)
        QtCore.QObject.connect(self.btnAdelante, QtCore.SIGNAL("clicked()"),
                               self.wvNavegador.forward)
        QtCore.QObject.connect(self.btnPagina, QtCore.SIGNAL("clicked()"),
                               self.wvNavegador.forward)
        QtCore.QObject.connect(self.btnRecargar, QtCore.SIGNAL("clicked()"),
                               self.cargarUrl)

        _url = "www.google.com"
        self.wvNavegador.load(QtCore.QUrl(_url))
        self.txtUrl.setText(_url)
Esempio n. 22
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.setWindowTitle("My Form")
        #self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        #self.showFullScreen()
        layout = QHBoxLayout()
        self.text = QTextEdit()
        self.scene = QGraphicsScene()
        self.view = QGraphicsView(self.scene)
        #layout.addWidget(self.text)
        layout.addWidget(self.view)
        #textItem = QGraphicsTextItem('test')
        #textItem.linkHovered.connect(self.itemHover)
        anotherItem = QGraphicsTextItem()
        anotherItem.setHtml(
            '<html><style>a { color: green; text-decoration: none; } a:hover { color: red; }</style><body>Another one <a id="test"  href="test">bites!</a></body></html>'
        )
        anotherItem.linkHovered.connect(self.itemHover)
        anotherItem.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
        #self.scene.addItem(textItem)
        self.scene.addItem(anotherItem)

        # USE THIS
        textBrowser = QtWebKit.QWebView()
        webPage = QtWebKit.QWebPage()
        webPage.mainFrame().setHtml(
            '<html><style>a { color: green; text-decoration: none; } a:hover { color: red; }</style><body>Another one <a id="test"  href="test">bites!</a></body></html>'
        )
        webPage.linkHovered.connect(self.itemHover)
        textBrowser.setPage(webPage)
        layout.addWidget(textBrowser)
        # END OF THIS

        label = QLabel(
            '<html><style>a { color: green; text-decoration: none; }</style><body>Another one <a id="test"  href="test">bites!</a></body></html>'
        )
        label.linkHovered.connect(self.itemHover)
        label.setStyleSheet('''a {
                            color: white;
                            }''')
        layout.addWidget(label)
        # Set dialog layout
        self.setLayout(layout)
Esempio n. 23
0
    def __init__(self):
        super(Foo, self).__init__()

        x, y, w, h = 100, 100, 900, 600
        self.setGeometry(x, y, w, h)

        self.source = QtGui.QTextEdit(self)
        self.preview = QtWebKit.QWebView(self)

        self.splitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
        self.splitter.addWidget(self.source)
        self.splitter.addWidget(self.preview)

        self.hbox = QtGui.QHBoxLayout(self)
        self.hbox.addWidget(self.splitter)
        self.setLayout(self.hbox)

        self.font = QtGui.QFont("Monaco", 13)
        self.setFont(self.font)
Esempio n. 24
0
 def setupWebView(self):
     self.o_results = QtWebKit.QWebView(self.frame0)
     sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.o_results.sizePolicy().hasHeightForWidth())
     self.o_results.setSizePolicy(sizePolicy)
     self.o_results.setMinimumSize(QtCore.QSize(300, 25))
     self.o_results.setMaximumSize(QtCore.QSize(16777215, 16777215))
     font = QtGui.QFont()
     font.setFamily("Arial")
     font.setPointSize(12)
     self.o_results.setFont(font)
     self.o_results.setProperty("cursor", QtCore.Qt.IBeamCursor)
     self.o_results.setAutoFillBackground(False)
     self.o_results.setHtml("""""")
     self.o_results.setObjectName("o_results")
     self.verticalLayout33.addWidget(self.o_results)
     self.o_results.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
Esempio n. 25
0
    def __init__(self, parent=None, file=None):
        super(PreviewDialog, self).__init__(parent)
        self.setAttribute(_QtCore.Qt.WA_DeleteOnClose)

        previewBox = _QtWebKit.QWebView()
        previewBox.settings().setAttribute(
            _QtWebKit.QWebSettings.PluginsEnabled, True)
        previewBox.settings().setAttribute(
            _QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        previewBox.settings().setAttribute(
            _QtWebKit.QWebSettings.PrivateBrowsingEnabled, True)
        previewBox.settings().setAttribute(
            _QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True)
        previewBox.load(_QtCore.QUrl().fromLocalFile(file))

        layout_Main = _QtGui.QVBoxLayout()
        layout_Main.addWidget(previewBox)
        self.setLayout(layout_Main)
        self.show()
Esempio n. 26
0
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.setWindowTitle("Web Browser")

        self.statusBar().showMessage("Ready", 5000)

        self.progress = 0
        self.homeURL = "http://www.google.com/"

        self.view = QtWebKit.QWebView(self)
        self.view.load(QtCore.QUrl(self.homeURL))
        self.view.loadProgress.connect(self.setProgress)
        self.view.titleChanged.connect(self.setTextProgress)
        self.view.loadFinished.connect(self.adjustLocation)
        self.view.loadFinished.connect(self.finishLoading)

        self.urlEdit = QtGui.QLineEdit(self)
        self.urlEdit.returnPressed.connect(self.chLocation)

        toolbar = self.addToolBar("Navigation")
        toolbar.addAction(self.view.pageAction(QtWebKit.QWebPage.Back))
        toolbar.addAction(self.view.pageAction(QtWebKit.QWebPage.Forward))
        toolbar.addWidget(self.urlEdit)
        toolbar.addAction(self.view.pageAction(QtWebKit.QWebPage.Reload))
        toolbar.addAction(self.view.pageAction(QtWebKit.QWebPage.Stop))

        closeAction = QtGui.QAction("&Exit", self)
        aboutAction = QtGui.QAction("&About", self)
        closeAction.triggered.connect(self.close)
        aboutAction.triggered.connect(self.aboutMess)

        menubar = QtGui.QMenuBar()
        fileMenu = QtGui.QMenu("&File")
        helpMenu = QtGui.QMenu("&Help")
        fileMenu.addAction(closeAction)
        helpMenu.addAction(aboutAction)
        menubar.addMenu(fileMenu)
        menubar.addMenu(helpMenu)
        self.setMenuBar(menubar)

        self.setCentralWidget(self.view)
Esempio n. 27
0
    def __init__(self):
        QtGui.QWidget.__init__(self, None)

        self._browser = QtWebKit.QWebView()
        self._browser.load(os.path.join(OUTDIR, 'index.html'))

        self._but1 = QtGui.QPushButton('Build + Reload', self)
        self._but2 = QtGui.QPushButton('Clean + Build + Reload', self)
        self._but1.clicked.connect(self._reload1)
        self._but2.clicked.connect(self._reload2)

        layout = QtGui.QVBoxLayout(self)
        self.setLayout(layout)
        sublayout = QtGui.QHBoxLayout()
        #
        sublayout.addWidget(self._but1, 1)
        sublayout.addWidget(self._but2, 1)
        #
        layout.addLayout(sublayout, 0)
        layout.addWidget(self._browser, 1)
Esempio n. 28
0
 def initUI(self):
     if self.url == "":
         content = QtGui.QLabel("Error, no documentation found...")
         layout = QtGui.QVBoxLayout()
     else:
         content = QtWebKit.QWebView()
         content.setUrl(self.url)
         layout = QtGui.QVBoxLayout()
     layout.addWidget(content)
     self.setLayout(layout)
     self.resize(1100, 650)
     self.setWindowTitle("MSDN documentation")
     frameGm = self.frameGeometry()
     screen = QtGui.QApplication.desktop().screenNumber(
         QtGui.QApplication.desktop().cursor().pos())
     centerPoint = QtGui.QApplication.desktop().screenGeometry(
         screen).center()
     frameGm.moveCenter(centerPoint)
     self.move(frameGm.topLeft())
     self.show()
Esempio n. 29
0
    def __init__(self, *args, **kwargs):
        backend = kwargs.pop('backend')
        config = kwargs.pop('config')
        super().__init__(*args, **kwargs)
        self.mainW = QtGui.QWidget()
        self.mainW.setWindowTitle('Err...')

        icon_path = os.path.join(os.path.dirname(errbot.__file__), 'err.svg')
        bg_path = os.path.join(os.path.dirname(errbot.__file__), 'err-bg.svg')
        self.mainW.setWindowIcon(QtGui.QIcon(icon_path))
        vbox = QtGui.QVBoxLayout()
        help_label = QtGui.QLabel(
            "CTRL+Space to autocomplete -- CTRL+Enter to send your message")
        self.input = CommandBox(backend.cmd_history, backend.commands,
                                config.BOT_PREFIX)
        self.output = QtWebKit.QWebView()

        # init webpage
        self.buffer = INIT_PAGE % (config.BOT_DATA_DIR, bg_path)
        self.output.setHtml(self.buffer)

        # layout
        vbox.addWidget(self.output)
        vbox.addWidget(self.input)
        vbox.addWidget(help_label)
        self.mainW.setLayout(vbox)

        # setup web view to open liks in external browser
        self.output.page().setLinkDelegationPolicy(
            QtWebKit.QWebPage.DelegateAllLinks)

        # connect signals/slots
        self.output.page().mainFrame().contentsSizeChanged.connect(
            self.scroll_output_to_bottom)
        self.output.page().linkClicked.connect(QtGui.QDesktopServices.openUrl)
        self.input.newCommand.connect(lambda text: backend.send_command(text))
        backend.conn.newAnswer.connect(self.new_message)

        self.mainW.show()
Esempio n. 30
0
    def __init__(self, filename, *args, **kwargs):
        super(Viewer, self).__init__(*args, **kwargs)
        self.monitor = FileMonitor(filename)
        self.toolbar = QtGui.QToolBar(self)
        self.webview = QtWebKit.QWebView(self)
        self._filename_label = QtGui.QLabel("")

        # Bind the monitor to reload the file.
        self.monitor.changed.connect(self._load_file)

        self.setWindowTitle(self.TITLE)

        vbox = QtGui.QVBoxLayout()
        self.setLayout(vbox)
        vbox.addWidget(self.toolbar)
        vbox.addWidget(self.webview)

        self._setup_toolbar()
        self._load_file()
        self.toolbar.show()
        self.webview.show()
        self.show()