예제 #1
0
    def __init__(self, exctype, excvalue, exctb):
        super(ExceptionDialog, self).__init__()
        
        self._tbshort = ''.join(traceback.format_exception_only(exctype, excvalue))
        self._tbfull = ''.join(traceback.format_exception(exctype, excvalue, exctb))
 
        layout = QVBoxLayout()
        self.setLayout(layout)
        
        self.errorLabel = QLabel()
        layout.addWidget(self.errorLabel)
        textview = QTextBrowser()
        layout.addWidget(textview)
        textview.setText(self._tbfull)
        textview.moveCursor(QTextCursor.End)
        
        layout.addWidget(widgets.Separator())
        
        b = self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        b.button(QDialogButtonBox.Ok).setIcon(icons.get("tools-report-bug"))
        layout.addWidget(b)
        
        b.accepted.connect(self.accept)
        b.rejected.connect(self.reject)
        self.resize(600,300)
        app.translateUI(self)
        self.exec_()
예제 #2
0
 def slotButtonShowDiff(self):
     """Called when the user clicks Show Difference."""
     docs = self.selectedDocuments() or self.allDocuments()
     if not docs:
         return
     d = docs[0]
     if documentwatcher.DocumentWatcher.instance(d).isdeleted():
         return
     
     filename = d.url().toLocalFile()
     try:
         with open(filename, 'rb') as f:
             disktext = util.decode(f.read())
     except (IOError, OSError):
         return
     
     currenttext = d.toPlainText()
     
     html = htmldiff.htmldiff(
         currenttext, disktext, 
         _("Current Document"), _("Document on Disk"), numlines=5)
     dlg = widgets.dialog.Dialog(self, buttons=('close',))
     view = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
     view.setHtml(html)
     dlg.setMainWidget(view)
     dlg.setWindowTitle(app.caption("Differences"))
     dlg.setMessage(_(
         "Document: {url}\n"
         "Difference between the current document and the file on disk:").format(
             url=filename))
     dlg.setWindowModality(Qt.NonModal)
     dlg.setAttribute(Qt.WA_QuitOnClose, False)
     dlg.setAttribute(Qt.WA_DeleteOnClose)
     qutil.saveDialogSize(dlg, "externalchanges/diff/dialog/size", QSize(600, 300))
     dlg.show()
예제 #3
0
    def __init__(self):
        QWidget.__init__(self)
        self.tray = Tray(self)
        self.setMinimumSize(QSize(320, 200))
        self.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setMargin(1)

        self.text = QTextBrowser(self)
        self.text.setReadOnly(True)
        self.text.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.text.setOpenExternalLinks(True)
        self.verticalLayout.addWidget(self.text)
        self.text.textChanged.connect(self.on_text_changed)
        self.notify = Notify(self)

        self.movie = QMovie()
        dev = QBuffer()
        dev.setData(QByteArray.fromBase64(CHECK_IMAGE))
        dev.open(QBuffer.ReadOnly)
        dev.setParent(self.movie)
        self.movie.setDevice(dev)
        self.movie.frameChanged.connect(self.on_frame_changed)

        self.realized = False
        self.show()
예제 #4
0
class Form(QDialog):

    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.browser = QTextBrowser()
        self.lineedit = QLineEdit("Type an expression and press Enter")
        self.lineedit.selectAll()
        layout = QVBoxLayout()
        layout.addWidget(self.browser)
        layout.addWidget(self.lineedit)
        self.setLayout(layout)
        self.lineedit.setFocus()
        self.connect(self.lineedit, SIGNAL("returnPressed()"),
                     self.updateUi)
        self.setWindowTitle("Calculate")

        self.button = QPushButton("Eval")
        layout.addWidget(self.button)
        self.connect(self.button, SIGNAL("pressed()"), self.updateUi)


    def updateUi(self):
        try:
            text = unicode(self.lineedit.text())
            self.browser.append("{0} = <b>{1}</b>".format(text,
                                eval(text)))
        except:
            self.browser.append("<font color=red>{0} is invalid!</font>"
                                .format(text))
예제 #5
0
class NewProjectManager(QDialog):

    def __init__(self, parent=None):
        super(NewProjectManager, self).__init__(parent, Qt.Dialog)
        self.setWindowTitle(translations.TR_NEW_PROJECT)
        self.setMinimumHeight(500)
        vbox = QVBoxLayout(self)
        vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE))
        vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS))

        hbox = QHBoxLayout()
        self.list_projects = QListWidget()
        self.list_projects.setProperty("wizard", True)
        hbox.addWidget(self.list_projects)

        self.list_templates = QListWidget()
        self.list_templates.setProperty("wizard", True)
        hbox.addWidget(self.list_templates)

        self.text_info = QTextBrowser()
        self.text_info.setProperty("wizard", True)
        hbox.addWidget(self.text_info)

        vbox.addLayout(hbox)

        hbox2 = QHBoxLayout()
        self.cancel = QPushButton(translations.TR_CANCEL)
        self.choose = QPushButton(translations.TR_CHOOSE)
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding,
            QSizePolicy.Fixed))
        hbox2.addWidget(self.cancel)
        hbox2.addWidget(self.choose)
        vbox.addLayout(hbox2)
예제 #6
0
파일: about.py 프로젝트: nyimbi/codimension
    def __createDescription( self ):
        " Creates the description browser "
        browser = QTextBrowser()
        browser.setHtml( """
<p align="justify">
Codimension is a free experimental Python IDE.
</p>
<p align="justify">
Codimension aims to provide an integrated system for:
<ul>
<li>traditional text-based code editing, and</li>
<li>diagram-based code analysis (e.g. imports and classes diagrams,
    profiling results etc).</li>
</ul>
</p>

<p align="justify">
Many Python developers will find codimension useful as-is, even though not all
of its features have been implemented yet.
</p>
<p align="justify">
More information could be found on <a href='http://satsky.spb.ru/codimension/'>
Codimension home page</a>.<br> Happy coding with Codimension!
</p>
""" )
        browser.setOpenExternalLinks( True )
        return browser
예제 #7
0
 def __init__(self, parent=None):
     QTextBrowser.__init__(self, parent)
     self.setFocusPolicy(Qt.NoFocus)
     self.setOpenLinks(False)
     self.setOpenExternalLinks(False)
     self.insertCursor = QTextCursor(self.document())
     self.formats = textFormats()
예제 #8
0
파일: about.py 프로젝트: nyimbi/codimension
 def __createVersioning( self ):
     " Creates the versioning section "
     components = getComponentInfo()
     text = "<p>The major Codimension components are listed below:</p>" \
            "<ul>"
     for (prettyName, version, homeURL,
          patched, license, licenseLink) in components:
         text += "<li><a href='" + homeURL + "'>" + prettyName + "</a><br>" \
                 "Version: "
         if version is not None and version[ 0 ].isdigit():
             text += version
         elif version is not None and version.lower() == "not installed":
             text += version.lower()
         elif version is None:
             text += "n/a"
         else:
             text += str( version )
         if patched:
             text += " (patched for codimension)"
         text += "<br>"
         text += "License: "
         if licenseLink.startswith( "http" ):
             text += "<a href='" + licenseLink + "'>" + license + "</a>"
         else:
             text += license + " (" + licenseLink + ")"
         text += "<br></li>"
     text += "</ul>"
     browser = QTextBrowser()
     browser.setHtml( text )
     browser.setOpenExternalLinks( True )
     return browser
예제 #9
0
 def keyPressEvent( self, event ):
     " Handles the key press events "
     if event.key() == Qt.Key_Escape:
         self.escapePressed.emit()
         event.accept()
     else:
         QTextBrowser.keyPressEvent( self, event )
     return
예제 #10
0
 def __init__(self, parent=None):
     super(Dialog, self).__init__(parent)
     
     self._info = None
     self._text = ''
     self._convertedtext = ''
     self._encoding = None
     self.mainwindow = parent
     
     self.fromVersionLabel = QLabel()
     self.fromVersion = QLineEdit()
     self.reason = QLabel()
     self.toVersionLabel = QLabel()
     self.toVersion = QLineEdit()
     self.lilyChooser = lilychooser.LilyChooser()
     self.messages = QTextBrowser()
     self.diff = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
     self.uni_diff = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
     self.copyCheck = QCheckBox(checked=
         QSettings().value('convert_ly/copy_messages', True, bool))
     self.tabw = QTabWidget()
     
     self.tabw.addTab(self.messages, '')
     self.tabw.addTab(self.diff, '')
     self.tabw.addTab(self.uni_diff, '')
     
     self.buttons = QDialogButtonBox(
         QDialogButtonBox.Reset | QDialogButtonBox.Save |
         QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     self.buttons.button(QDialogButtonBox.Ok).clicked    .connect(self.accept)
     self.buttons.rejected.connect(self.reject)
     self.buttons.button(QDialogButtonBox.Reset).clicked.connect(self.run)
     self.buttons.button(QDialogButtonBox.Save).clicked.connect(self.saveFile)
     
     layout = QVBoxLayout()
     self.setLayout(layout)
     
     grid = QGridLayout()
     grid.addWidget(self.fromVersionLabel, 0, 0)
     grid.addWidget(self.fromVersion, 0, 1)
     grid.addWidget(self.reason, 0, 2, 1, 3)
     grid.addWidget(self.toVersionLabel, 1, 0)
     grid.addWidget(self.toVersion, 1, 1)
     grid.addWidget(self.lilyChooser, 1, 3, 1, 2)
     
     layout.addLayout(grid)
     layout.addWidget(self.tabw)
     layout.addWidget(self.copyCheck)
     layout.addWidget(widgets.Separator())
     layout.addWidget(self.buttons)
     
     app.translateUI(self)
     qutil.saveDialogSize(self, 'convert_ly/dialog/size', QSize(600, 300))
     app.settingsChanged.connect(self.readSettings)
     self.readSettings()
     self.finished.connect(self.saveCopyCheckSetting)
     self.lilyChooser.currentIndexChanged.connect(self.slotLilyPondVersionChanged)
     self.slotLilyPondVersionChanged()
예제 #11
0
    def __init__(self, parent=None):
        QTextBrowser.__init__(self, parent)
        self.setOpenLinks(False)

        self.item = None
        self.dirty = False

        self._clear()
        self._showPluginInfo()

        self.connect(self, SIGNAL("anchorClicked(const QUrl&)"), self._linkClicked)
예제 #12
0
        def __init__(self, parent=None):
                QTextBrowser.__init__(self, parent)
                self.setOpenLinks(False)

                self.item = None
                self.dirty = False

                self._clear()
                self._showPluginInfo()

                self.connect(self, SIGNAL("anchorClicked(const QUrl&)"), self._linkClicked)
예제 #13
0
 def __init__(self, parent=None, text=""):
     QDialog.__init__ (self, parent)
     #initialise the display text edit
     display = QTextBrowser(self)
     display.setReadOnly(True)
     #initialise grid layout for dialog
     hbox = QHBoxLayout(self)
     hbox.addWidget(display)
     self.setWindowTitle("manageR - Help")
     display.setPlainText(text)
     self.resize(750, 400)
예제 #14
0
    def __init__(self, *args, **kwargs):
        QTextBrowser.__init__(self, *args, **kwargs)

        self.setOpenExternalLinks(False)
        self.setOpenLinks(False)

        self.__text = ""
        self.__permanentText = ""

        self.__timer = QTimer(self, timeout=self.__on_timeout,
                              singleShot=True)
        self.anchorClicked.connect(self.__on_anchorClicked)
예제 #15
0
 def __init__(self, parent=None):
     super(Dialog, self).__init__(parent)
     
     self._info = None
     self._text = ''
     self._convertedtext = ''
     self._encoding = None
     
     self.fromVersionLabel = QLabel()
     self.fromVersion = QLineEdit()
     self.reason = QLabel()
     self.toVersionLabel = QLabel()
     self.toVersion = QLineEdit()
     self.messages = QTextBrowser()
     self.diff = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
     self.copyCheck = QCheckBox(checked=
         QSettings().value('convert_ly/copy_messages', True, bool))
     self.tabw = QTabWidget()
     
     self.tabw.addTab(self.messages, '')
     self.tabw.addTab(self.diff, '')
     
     self.buttons = QDialogButtonBox(
         QDialogButtonBox.Reset |
         QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     self.buttons.accepted.connect(self.accept)
     self.buttons.rejected.connect(self.reject)
     self.buttons.button(QDialogButtonBox.Reset).clicked.connect(self.run)
     
     layout = QVBoxLayout()
     self.setLayout(layout)
     
     top = QHBoxLayout()
     top.addWidget(self.fromVersionLabel)
     top.addWidget(self.fromVersion)
     top.addWidget(self.reason)
     top.addStretch()
     top.addWidget(self.toVersionLabel)
     top.addWidget(self.toVersion)
     
     layout.addLayout(top)
     layout.addWidget(self.tabw)
     layout.addWidget(self.copyCheck)
     layout.addWidget(widgets.Separator())
     layout.addWidget(self.buttons)
     
     app.translateUI(self)
     qutil.saveDialogSize(self, 'convert_ly/dialog/size', QSize(600, 300))
     app.settingsChanged.connect(self.readSettings)
     self.readSettings()
     self.finished.connect(self.saveCopyCheckSetting)
예제 #16
0
 def __createAuthors( self ):
     " Creates the authors section "
     addr1 = "<a href='mailto:[email protected]'>[email protected]</a>"
     addr2 = "<a href='mailto:[email protected]'>[email protected]</a>"
     addr3 = "<a href='mailto:[email protected]'>[email protected]</a>"
     text = "<p>Author: Sergey Satskiy &lt;" + addr1 + "&gt;</p>" \
            "<p>Packaging: Ilya Loginov &lt;" + addr2 + "&gt;</p>" \
            "<p>Initial packaging and logo: Dmitry Kazimirov &lt;" + addr3 + "&gt;</p>" \
            "<p align='justify'>Special thanks: Detlev Offenbach - the author of the Eric Python IDE." \
            " Codimension borrows some code and some ideas from Eric 4.</p>"
     browser = QTextBrowser()
     browser.setHtml( text )
     browser.setOpenExternalLinks( True )
     return browser
예제 #17
0
 def __init__(self, parent=None, text=""):
     #super(HelpForm, self).__init__(parent)
     self.setAttribute(Qt.WA_GroupLeader)
     self.setAttribute(Qt.WA_DeleteOnClose)
     browser = QTextBrowser()
     browser.setOpenExternalLinks(True)
     browser.setHtml(text)
     layout = QVBoxLayout()
     layout.setMargin(0)
     layout.addWidget(browser)
     self.setLayout(layout)
     self.resize(400, 200)
     QShortcut(QKeySequence("Escape"), self, self.close)
     self.setWindowTitle("R plugin - Help")
예제 #18
0
 def __init__(self, parent=None, host="localhost", port=5432,
              home="index.html", paths=None):
     QTextBrowser.__init__(self, parent)
     self.http = QHttp()
     self.http.setHost(host, port)
     home = QUrl(home)
     self.base = home
     self.html = QString()
     self.setOpenLinks(True)
     if not paths is None:
         self.setSearchPaths(paths)
     self.connect(self.http, SIGNAL("done(bool)"), self.getData)
     self.anchor = QString()
     self.setSource(home)
예제 #19
0
class TimeDialog(QWidget):
    def __init__(self):
        super(TimeDialog, self).__init__()
        self.timer_tv = QTextBrowser(self)
        self.init_ui()
        self.timer_t = TimeThread()
        self.timer_t.signal_time.connect(self.update_timer_tv)

    def init_ui(self):
        self.resize(300, 200)
        self.setWindowTitle('TimeDialog')
        self.timer_tv.setText("Wait")
        self.timer_tv.setGeometry(QtCore.QRect(10, 145, 198, 26))
        self.timer_tv.move(0, 15)

        btn1 = QPushButton('Quit', self)
        btn1.setToolTip('Click to quit')
        btn1.resize(btn1.sizeHint())
        btn1.move(200, 150)
        btn1.clicked.connect(QCoreApplication.instance().quit)

        start_btn = QPushButton('Start', self)
        start_btn.setToolTip("Click to start")
        start_btn.move(50, 150)
        self.connect(start_btn, QtCore.SIGNAL("clicked()"),
                     self.click_start_btn)

    def click_start_btn(self):
        self.timer_t.start_timer()

    def update_timer_tv(self, text, number):
        self.timer_tv.setText(self.tr(text + " " + str(number)))
예제 #20
0
    def createGUI(self):
        ## help tool bar
        self.toolBar = QToolBar(self)
        ## help text Browser
        self.textBrowser = QTextBrowser(self)

        layout = QVBoxLayout(self)
        layout.addWidget(self.toolBar)
        layout.addWidget(self.textBrowser, 1)

        self.setLayout(layout)
        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(self._page))
        self.resize(660, 700)
        self.setWindowTitle("%s Help" % (QApplication.applicationName()))
예제 #21
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
       
        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.anotherFortuneButton = QPushButton(self.tr("One More!"), self)
        self.anotherFortuneButton.clicked.connect(self.onClickAnotherFortuneButton)
        self.hBoxSizer.addWidget(self.anotherFortuneButton)

        idx = random.choice(range(len(self.prm['appData']['fortunesList'])))

        self.browser.append(self.prm['appData']['fortunesList'][idx]['quote'])
        self.browser.append('\n')
        self.browser.append(self.prm['appData']['fortunesList'][idx]['author'])
        self.browser.append("In:" + self.prm['appData']['fortunesList'][idx]['source'])

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)
        
        self.vBoxSizer.addWidget(self.browser)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        #self.vBoxSizer.setSizeConstraint(QLayout.SetFixedSize)
        
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("pychoacoustics - fortunes"))
        self.resize(450, 450)
        self.show()
예제 #22
0
파일: helpdialog.py 프로젝트: Tayyib/uludag
class HelpDialog(QDialog):
    def __init__(self, parent, help):
        QDialog.__init__(self, parent)
        self.setModal(True)
        self.setWindowTitle(i18n("Package Manager Help"))
        self.layout = QGridLayout(self)
        self.htmlPart = QTextBrowser(self)
        self.resize(700,500)
        self.layout.addWidget(self.htmlPart,1,1)

        locale = setSystemLocale(justGet = True)

        if locale in ["tr", "es", "en", "fr", "nl", "de", "sv"]:
            self.htmlPart.setSource(QUrl("/usr/share/package-manager/help/%s/%s" % (locale, help_files[help])))
        else:
            self.htmlPart.setSource(QUrl("/usr/share/package-manager/help/en/%s" % help_files[help]))
예제 #23
0
 def __init__( self, parent, cmdline, localdict={} ):
     QTextBrowser.__init__( self, parent )
     QObject.connect( cmdline, SIGNAL( "returnPressed()" ),
                      self.returnPressed )
     self.setFont(QFont("Fixed",10))
     self.console = InteractiveConsole( localdict )
     self.cmdline = cmdline
     sys.ps1 = ">>> "
     sys.ps2 = "... "
     self.append("---- OpusPython ----")
     self.append( "Python %s on %s\n" % ( sys.version, sys.platform) )
     self.append("--------")
     self.more, self.prompt = 0, sys.ps1
     self.output = OpusPythonShell.Output(self.writeResult)
     self.stdout = sys.stdout
     self.stderr = sys.stderr
예제 #24
0
    def __init__(self):

        QWidget.__init__(self)
        self.rawstr = r"""(?:^.*Track .*?\d*\D*)(\d{1,})(?:\D*of.*?)(\d{1,})(?:.*?MB written.*$)"""
        self.compile_obj = re.compile(self.rawstr, re.MULTILINE)
        
        self.textBrowser = QTextBrowser(self)
        self.lineEdit = QLineEdit(self)
        self.startButton = QPushButton(self.tr("Start"), self)
        self.stopButton = QPushButton(self.tr("Stop"), self)
        self.stopButton.setEnabled(False)
        
        self.list1 = QStringList()
        self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.startCommand)
        self.connect(self.startButton, SIGNAL("clicked()"), self.startCommand)
        self.connect(self.stopButton, SIGNAL("clicked()"), self.stopCommand)

        layout = QGridLayout(self)
        layout.setSpacing(8)
        layout.addWidget(self.textBrowser, 0, 0)
        layout.addWidget(self.lineEdit, 1, 0)
        layout.addWidget(self.startButton, 1, 1)
        layout.addWidget(self.stopButton, 1, 2)

 
        self.process = QProcess()
        self.connect(self.process, SIGNAL("readyReadStandardOutput()"), self.readOutput)
        self.connect(self.process, SIGNAL("readyReadStandardError()"), self.readErrors)
        self.connect(self.process, SIGNAL("finished(int)"), self.resetButtons)
예제 #25
0
    def __init__(self):
        QWidget.__init__(self)
        self.tray = Tray(self)
        self.setMinimumSize(QSize(320, 200))
        self.setWindowFlags(Qt.Popup|Qt.FramelessWindowHint)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setMargin(1)

        self.text = QTextBrowser(self)
        self.text.setReadOnly(True)
        self.text.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.text.setOpenExternalLinks(True)
        self.verticalLayout.addWidget(self.text)
        self.text.textChanged.connect(self.on_text_changed)
        self.notify = Notify(self)

        self.movie = QMovie()
        dev = QBuffer()
        dev.setData(QByteArray.fromBase64(CHECK_IMAGE))
        dev.open(QBuffer.ReadOnly)
        dev.setParent(self.movie)
        self.movie.setDevice(dev)
        self.movie.frameChanged.connect(self.on_frame_changed)

        self.realized = False
        self.show()
예제 #26
0
파일: helpform.py 프로젝트: dpeinado/restec
    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("{0} Help".format(
                QApplication.applicationName()))
예제 #27
0
    def setHtml(self, html):
        # convert special tags :)
        html = unicode(html).replace('<warning>', '<img src=":/db_manager/warning">&nbsp;&nbsp; ')

        # add default style
        html = u"""
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
        .section { margin-top: 25px; }
        table.header th { background-color: #dddddd; }
        table.header td { background-color: #f5f5f5; }
        table.header th, table.header td { padding: 0px 10px; }
        table td { padding-right: 20px; }
        .underline { text-decoration:underline; }
</style>
</head>
<body>
%s <br>
</body>
</html>
""" % html

        # print ">>>>>\n", html, "\n<<<<<<"
        return QTextBrowser.setHtml(self, html)
예제 #28
0
    def __init__(self, connectionManager, parent=None):
        QWidget.__init__(self, parent)

        self.connectionManager = connectionManager
        self.isDisabled = False
        self.wasCleared = False

        self.urlRegex = re.compile(constants.URL_REGEX)

        self.chatLog = QTextBrowser()
        self.chatLog.setOpenExternalLinks(True)

        self.chatInput = QTextEdit()
        self.chatInput.textChanged.connect(self.chatInputTextChanged)

        self.sendButton = QPushButton("Send")
        self.sendButton.clicked.connect(self.sendMessage)

        # Set the min height for the chatlog and a matching fixed height for the send button
        chatInputFontMetrics = QFontMetrics(self.chatInput.font())
        self.chatInput.setMinimumHeight(chatInputFontMetrics.lineSpacing() * 3)
        self.sendButton.setFixedHeight(chatInputFontMetrics.lineSpacing() * 3)

        hbox = QHBoxLayout()
        hbox.addWidget(self.chatInput)
        hbox.addWidget(self.sendButton)

        # Put the chatinput and send button in a wrapper widget so they may be added to the splitter
        chatInputWrapper = QWidget()
        chatInputWrapper.setLayout(hbox)
        chatInputWrapper.setMinimumHeight(chatInputFontMetrics.lineSpacing() *
                                          3.7)

        # Put the chat log and chat input into a splitter so the user can resize them at will
        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.chatLog)
        splitter.addWidget(chatInputWrapper)
        splitter.setSizes([int(parent.height()), 1])

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

        self.typingTimer = QTimer()
        self.typingTimer.setSingleShot(True)
        self.typingTimer.timeout.connect(self.stoppedTyping)
예제 #29
0
    def __init__(self, parent=None):
        super(NewProjectManager, self).__init__(parent, Qt.Dialog)
        self.setWindowTitle(translations.TR_NEW_PROJECT)
        self.setMinimumHeight(500)
        vbox = QVBoxLayout(self)
        vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE))
        vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS))

        hbox = QHBoxLayout()
        self.list_projects = QListWidget()
        self.list_projects.setProperty("wizard", True)
        hbox.addWidget(self.list_projects)

        self.list_templates = QListWidget()
        self.list_templates.setProperty("wizard", True)
        hbox.addWidget(self.list_templates)

        self.text_info = QTextBrowser()
        self.text_info.setProperty("wizard", True)
        hbox.addWidget(self.text_info)

        vbox.addLayout(hbox)

        hbox2 = QHBoxLayout()
        cancel = QPushButton(translations.TR_CANCEL)
        choose = QPushButton(translations.TR_CHOOSE)
        hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding,
                            QSizePolicy.Fixed))
        hbox2.addWidget(cancel)
        hbox2.addWidget(choose)
        vbox.addLayout(hbox2)

        self.template_registry = IDE.get_service("template_registry")
        categories = self.template_registry.list_project_categories()
        for category in categories:
            self.list_projects.addItem(category)

        self.connect(cancel, SIGNAL("clicked()"), self.close)
        self.connect(choose, SIGNAL("clicked()"), self._start_wizard)
        self.connect(self.list_projects,
                     SIGNAL("itemSelectionChanged()"),
                     self._project_selected)
        self.connect(self.list_templates,
                     SIGNAL("itemSelectionChanged()"),
                     self._template_selected)
예제 #30
0
    def __init__(self, event_handler, app_status_file_path):
        QtGui.QWidget.__init__(self)
        self.buttons_status_tag = "BUTTONS STATUS"
        self.app_status_file_path = app_status_file_path
        self.event_handler = event_handler
        self.setWindowTitle("TEST PANEL")
        self.x_siz, self.y_siz = 600, 400

        self.read_sram_button = PushButton("READ SRAM",
                                           tip_msg=READ_SRAM_BTN_TIP)
        self.read_sram_button.clicked.connect(
            self.event_handler.read_sram_button_slot)

        self.test_sram_button = PushButton("TEST SRAM",
                                           tip_msg=TEST_SRAM_BTN_TIP)
        self.test_sram_button.clicked.connect(
            self.event_handler.test_sram_chip_slot)

        self.test_upload_button = PushButton("TEST UPLOAD",
                                             tip_msg=TEST_UPLOAD_BTN_TIP)
        self.test_upload_button.clicked.connect(
            self.event_handler.test_upload_slot)

        self.text_browser = QTextBrowser()

        self.digidiag_on_checkbox = CheckBox("Show dididiag data panels",
                                             tip_msg="Enable digidiag")
        self.digidiag_on_checkbox.clicked.connect(self.show_digidiag)
        config = configparser.ConfigParser()
        config.read(self.app_status_file_path)
        try:
            if config[self.buttons_status_tag]['digidiag_show'] == 'True':
                self.digidiag_on_checkbox.setChecked(True)
                self.show_digidiag()
        except KeyError:
            pass
        mainGrid = QtGui.QGridLayout()
        mainGrid.setSpacing(10)
        mainGrid.addWidget(self.read_sram_button, 0, 0)
        mainGrid.addWidget(self.test_sram_button, 0, 1)
        mainGrid.addWidget(self.test_upload_button, 0, 2)
        mainGrid.addWidget(self.digidiag_on_checkbox, 1, 0)
        mainGrid.addWidget(self.text_browser, 2, 0, 10, 3)
        self.setLayout(mainGrid)
        self.resize(self.x_siz, self.y_siz)
예제 #31
0
 def loadResource(self, type, name):
     ret = QVariant()
     name.setFragment(QString())
     if type == QTextDocument.HtmlResource:
         loop = QEventLoop()
         self.connect(self.http, SIGNAL("done(bool)"), loop, SLOT("quit()"))
         self.http.get(name.toString())
         loop.exec_(QEventLoop.AllEvents|QEventLoop.WaitForMoreEvents)
         data = QVariant(QString(self.html))
         if data.toString().trimmed().isEmpty():
             fileName = QFileInfo(
             name.toLocalFile()).fileName()
             data = QTextBrowser.loadResource(self, type, QUrl(fileName))
     else:
         fileName = QFileInfo(
         name.toLocalFile()).fileName()
         data = QTextBrowser.loadResource(self, type, QUrl(fileName))
     return data
예제 #32
0
파일: logger2.py 프로젝트: yshao/weathergit
    def setUp(self):
        ""
        self.logger = logging.getLogger(__name__)
        handler = QtHandler()
        handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        self.logger.addHandler(handler)
        self.logger.setLevel(logging.DEBUG)

        self.outHandlerGui=QTextBrowser()
예제 #33
0
 def _add_log_box(self):
     box = QGroupBox("Application log")
     box.setLayout(QHBoxLayout(box))
     
     self.log_area = QTextBrowser(box)
     self.log_area.setLineWrapMode(QTextEdit.NoWrap)
     
     box.layout().addWidget(self.log_area)
     self.layout().addWidget(box)
예제 #34
0
    def __init__(self, parent=None, **kwargs):
        super(AddonManagerWidget, self).__init__(parent, **kwargs)

        #: list of Available | Installed
        self.__items = []
        self.setLayout(QVBoxLayout())

        self.__header = QLabel(
            wordWrap=True,
            textFormat=Qt.RichText
        )
        self.__search = QLineEdit(
            placeholderText=self.tr("Filter")
        )

        self.layout().addWidget(self.__search)

        self.__view = view = QTreeView(
            rootIsDecorated=False,
            editTriggers=QTreeView.NoEditTriggers,
            selectionMode=QTreeView.SingleSelection,
            alternatingRowColors=True
        )
        self.__view.setItemDelegateForColumn(0, TristateCheckItemDelegate())
        self.layout().addWidget(view)

        self.__model = model = QStandardItemModel()
        model.setHorizontalHeaderLabels(["", "Name", "Version", "Action"])
        model.dataChanged.connect(self.__data_changed)
        proxy = QSortFilterProxyModel(
            filterKeyColumn=1,
            filterCaseSensitivity=Qt.CaseInsensitive
        )
        proxy.setSourceModel(model)
        self.__search.textChanged.connect(proxy.setFilterFixedString)

        view.setModel(proxy)
        view.selectionModel().selectionChanged.connect(
            self.__update_details
        )
        header = self.__view.header()
        header.setResizeMode(0, QHeaderView.Fixed)
        header.setResizeMode(2, QHeaderView.ResizeToContents)

        self.__details = QTextBrowser(
            frameShape=QTextBrowser.NoFrame,
            readOnly=True,
            lineWrapMode=QTextBrowser.WidgetWidth,
            openExternalLinks=True,
        )

        self.__details.setWordWrapMode(QTextOption.WordWrap)
        palette = QPalette(self.palette())
        palette.setColor(QPalette.Base, Qt.transparent)
        self.__details.setPalette(palette)
        self.layout().addWidget(self.__details)
예제 #35
0
def run(filename):
    tree, changes = ut.get_changes(xml_filename=filename,
                                   encoding='utf8',
                                   window_size=128)
    application = QtGui.QApplication(sys.argv)
    win = QtGui.QWidget()
    table_view = TableView()
    model = Model(tree, changes, filename)
    proxyModel = QtGui.QSortFilterProxyModel()
    proxyModel.setSourceModel(model)
    proxyModel.save = model.save
    proxyModel._data = model._data
    table_view.setModel(proxyModel)
    table_view.setSortingEnabled(True)
    table_view.setAlternatingRowColors(True)
    for i, col in enumerate(COLS):
        if col in COL_SIZES:
            table_view.setColumnWidth(i, COL_SIZES[col])
    table_view.horizontalHeader().setStretchLastSection(True)
    table_view.setColumnHidden(NUM2COLS['id'], True)
    table_view.setColumnHidden(NUM2COLS['diff'], True)

    text_view = QTextBrowser()
    DIFF_COL = NUM2COLS['diff']

    def update_diff(item):
        text_view.setHtml(item.model().index(item.row(),
                                             DIFF_COL).data().toString())

    table_view.doubleClicked.connect(update_diff)

    layout = QtGui.QVBoxLayout()
    layout.addWidget(table_view)
    text_view.setFixedHeight(150)
    layout.addWidget(text_view)
    layout.setContentsMargins(0, 0, 0, 0)
    layout.setSpacing(0)
    win.setLayout(layout)
    win.setWindowTitle('Medite Tagger')
    win.setGeometry(100, 100, 1600, 800)
    win.show()

    sys.exit(application.exec_())
예제 #36
0
    def initUI(self):

        fec_ini = Gsucave.ini_trim.strftime("%d/%m")  # @UndefinedVariable
        fec_fin = Gsucave.fin_trim.strftime("%d/%m")  # @UndefinedVariable

        lblreporte = QLabel(str.format("Ingrese la ruta del reporte de Enotria"
                                       " del {} al {}:", fec_ini, fec_fin))

        self.txtreporte = QLineEdit(unicode("X:\\Servicio al Cliente"
        "\\Seguimiento SAC\\Procesos Centralizados (CG)"
        "\\SSC - Servicio de Soporte Comercial\\Servicio de Soporte Comercial"
        "\\1.REPORTES SUCAVE POLIZAS ELECTRONICAS\\2014\\I trimestre"
        "\\Copia de ConsultaMa2014_il.xlsx"))
        
        btnreporte = QPushButton("...")
        btnreporte.setMaximumWidth(30)
        btnreporte.clicked.connect(self.elegir_base)

        hboxreporte = QHBoxLayout()
        hboxreporte.addWidget(self.txtreporte)
        hboxreporte.addWidget(btnreporte)

        lblsalida = QLabel(unicode("Ingrese la ruta de donde se generará "
                                   "el reporte de SUCAVE:"))

        self.txtsalida = QLineEdit("")
        btnsalida = QPushButton("...")
        btnsalida.setMaximumWidth(30)
        btnsalida.clicked.connect(self.elegir_salida)

        hboxsalida = QHBoxLayout()
        hboxsalida.addWidget(self.txtsalida)
        hboxsalida.addWidget(btnsalida)

        self.tbsalida = QTextBrowser()
        self.tbsalida.append("Haga click en Generar para generar el reporte"
                             " de SUCAVE.")

        btngenerar = QPushButton("Generar")
        btngenerar.clicked.connect(self.generar)
        btngenerar.setMinimumHeight(35)

        vbox = QVBoxLayout()
        vbox.addWidget(lblreporte)
        vbox.addLayout(hboxreporte)
        vbox.addWidget(lblsalida)
        vbox.addLayout(hboxsalida)
        vbox.addWidget(self.tbsalida)
        vbox.addWidget(btngenerar)

        self.setLayout(vbox)
        self.setWindowTitle("Generador Sucave")
        self.setWindowIcon(QIcon(":pacifico256.png"))
        self.setGeometry(300, 300, 450, 375)
        self.show()
예제 #37
0
    def __init__(self, logfile_path, *args, **kwargs):
        super(LogDisplayWidget, self).__init__(*args, **kwargs)
        self.logfile_path = logfile_path
        self.text_browser = QTextBrowser(self)
        self.text_browser.setStyleSheet("font: 12pt \"Courier\";")
        button = QPushButton("Show log", clicked=self.update_log_display)

        layout = QVBoxLayout()
        layout.addWidget(self.text_browser)
        layout.addWidget(button)
        self.setLayout(layout)
예제 #38
0
    def create_widgets(self):
        self.backAction = QAction(QIcon(":/back.png"), "&Back", self)
        self.backAction.setShortcut(QKeySequence.Back)
        self.homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        self.homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        self.toolBar = QToolBar()
        self.toolBar.addAction(self.backAction)
        self.toolBar.addAction(self.homeAction)
        self.toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()
    def __init__(self, parent, diffText):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)

        self.vBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)

        self.browser.append(diffText)
        self.browser.verticalScrollBar().setValue(
            self.browser.verticalScrollBar().minimum())

        cursor = self.browser.textCursor()
        cursor.setPosition(0)
        self.browser.setTextCursor(cursor)

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)

        self.vBoxSizer.addWidget(self.browser)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)
        self.vBoxSizer.addWidget(buttonBox)

        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Diff"))

        screen = QDesktopWidget().screenGeometry()
        wd = screen.width() / 4
        ht = screen.height() / 3
        self.resize(wd, ht)
        self.show()
예제 #40
0
    def __init__(self, exctype, excvalue, exctb):
        super(ExceptionDialog, self).__init__()

        self._tbshort = ''.join(
            traceback.format_exception_only(exctype, excvalue))
        self._tbfull = ''.join(
            traceback.format_exception(exctype, excvalue, exctb))

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.errorLabel = QLabel()
        layout.addWidget(self.errorLabel)
        textview = QTextBrowser()
        layout.addWidget(textview)
        textview.setText(self._tbfull)
        textview.moveCursor(QTextCursor.End)

        layout.addWidget(widgets.Separator())

        b = self.buttons = QDialogButtonBox(QDialogButtonBox.Ok
                                            | QDialogButtonBox.Cancel)
        b.button(QDialogButtonBox.Ok).setIcon(icons.get("tools-report-bug"))
        layout.addWidget(b)

        b.accepted.connect(self.accept)
        b.rejected.connect(self.reject)
        self.resize(600, 300)
        app.translateUI(self)
        self.exec_()
예제 #41
0
 def __createVersioning(self):
     " Creates the versioning section "
     components = getComponentInfo()
     text = "<p>The major Codimension components are listed below:</p>" \
            "<ul>"
     for (prettyName, version, homeURL, patched, license, licenseLink,
          localPath) in components:
         text += "<li><a href='" + homeURL + "'>" + prettyName + "</a><br>" \
                 "Version: "
         if version is not None and version[0].isdigit():
             text += version
         elif version is not None and version.lower() == "not installed":
             text += version.lower()
         elif version is None:
             text += "n/a"
         else:
             text += str(version)
         if patched:
             text += " (patched for codimension)"
         text += "<br>"
         text += "License: "
         if licenseLink.startswith("http"):
             text += "<a href='" + licenseLink + "'>" + license + "</a>"
         else:
             text += license + " (" + licenseLink + ")"
         if localPath:
             text += "<br/>Local path: " + localPath
         text += "<br></li>"
     text += "</ul>"
     browser = QTextBrowser()
     browser.setHtml(text)
     browser.setOpenExternalLinks(True)
     return browser
예제 #42
0
    def __createDescription(self):
        " Creates the description browser "
        browser = QTextBrowser()
        browser.setHtml("""
<p align="justify">
Codimension is a free experimental Python IDE.
</p>
<p align="justify">
Codimension aims to provide an integrated system for:
<ul>
<li>traditional text-based code editing, and</li>
<li>diagram-based code analysis (e.g. imports and classes diagrams,
    profiling results etc).</li>
</ul>
</p>

<p align="justify">
Many Python developers will find codimension useful as-is, even though not all
of its features have been implemented yet.
</p>
<p align="justify">
More information could be found on <a href='http://codimension.org'>
Codimension home page</a>.<br> Happy coding with Codimension!
</p>
""")
        browser.setOpenExternalLinks(True)
        return browser
예제 #43
0
    def __init__(self, parent, help):
        QDialog.__init__(self, parent)

        self.setWindowTitle(i18n("Package Manager Help"))
        self.resize(700, 500)
        self.setModal(True)

        self.layout = QGridLayout(self)
        self.htmlPart = QTextBrowser(self)
        self.layout.addWidget(self.htmlPart, 1, 1)

        locale = setSystemLocale(justGet=True)

        if locale in ["tr", "es", "en", "fr", "nl", "de", "sv"]:
            self.htmlPart.setSource(
                QUrl("/usr/share/kde4/apps/package-manager/help/%s/%s" %
                     (locale, help_files[help])))

        else:
            self.htmlPart.setSource(
                QUrl("/usr/share/kde4/apps/package-manager/help/en/%s" %
                     help_files[help]))
예제 #44
0
    def slotButtonShowDiff(self):
        """Called when the user clicks Show Difference."""
        docs = self.selectedDocuments() or self.allDocuments()
        if not docs:
            return
        d = docs[0]
        if documentwatcher.DocumentWatcher.instance(d).isdeleted():
            return

        filename = d.url().toLocalFile()
        try:
            with open(filename, 'rb') as f:
                disktext = util.decode(f.read())
        except (IOError, OSError):
            return

        currenttext = d.toPlainText()

        html = htmldiff.htmldiff(currenttext,
                                 disktext,
                                 _("Current Document"),
                                 _("Document on Disk"),
                                 numlines=5)
        dlg = widgets.dialog.Dialog(self, buttons=('close', ))
        view = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
        view.setHtml(html)
        dlg.setMainWidget(view)
        dlg.setWindowTitle(app.caption("Differences"))
        dlg.setMessage(
            _("Document: {url}\n"
              "Difference between the current document and the file on disk:").
            format(url=filename))
        dlg.setWindowModality(Qt.NonModal)
        dlg.setAttribute(Qt.WA_QuitOnClose, False)
        dlg.setAttribute(Qt.WA_DeleteOnClose)
        qutil.saveDialogSize(dlg, "externalchanges/diff/dialog/size",
                             QSize(600, 300))
        dlg.show()