Exemplo n.º 1
0
 def __init__(self, app, parent, doc):
     KTextBrowser.__init__(self, parent)
     self.setMimeSourceFactory(MimeSources())
     self.app = app
     self.db = app.db
     self.doc = doc(self.app)
     self.setNotifyClick(True)
Exemplo n.º 2
0
 def setMimeSourceFactory(self, factory=None):
     if factory is None:
         self.mimes = QMimeSourceFactory()
         self.mimes.addFilePath('/usr/share/wallpapers')
     else:
         self.mimes = factory
     KTextBrowser.setMimeSourceFactory(self, self.mimes)
Exemplo n.º 3
0
 def append(self, text, color=None, bold=False):
     text = keepspaces(text)
     if bold:
         text = "<b>%s</b>" % text
     if color:
         text = "<font color=%s>%s</font>" % (color, text)
     KTextBrowser.append(self, text)
Exemplo n.º 4
0
 def __init__(self, parent=None):
     KTextBrowser.__init__(self, parent, None, True)
     self.setTextFormat(Qt.RichText)
     self.setFont(QFont("Sans", 9))
     def runAction(url):
         from lilykde import actions
         actions.runAction(url)
     QObject.connect(self, SIGNAL("urlClick(const QString&)"), runAction)
 def __init__(self, parent, name='AuditGameDialog'):
     BaseDialogWindow.__init__(self, parent, name=name)
     #self.grid = QGridLayout(self, 2, 1, 5, 7)
     self.frame = KTextBrowser(self)
     self.frame.setNotifyClick(True)
     self.frame.setSource = self.setSource
     self.doc = AuditGameDocument(self.app)
     #self.grid.addWidget(self.frame, 0, 0)
     self.progress_label = QLabel(self)
     self.progress = KProgress(self)
     #self.grid.addWidget(self.progress, 1, 0)
     self.setMainWidget(self.frame)
     layout = self.layout()
     # we use insertWidget instead of
     # addWidget here so the widgets
     # are above the dialog buttons
     # self frame should be at 0 index in the layout
     # we set the progress and label below this
     layout.insertWidget(1, self.progress)
     # inserting into index 1 here knocks self.progress down to 2
     layout.insertWidget(1, self.progress_label)
     # disable and hide extra buttons
     self.enableButtonApply(False)
     self.showButtonApply(False)
     self.enableButtonCancel(False)
     self.showButtonCancel(False)
     # the dialog should be a little taller than what
     # it defaults to
     self.resize(0, 300)
Exemplo n.º 6
0
class TestConfigTab(QWidget):
    def __init__(self, parent, name='TestConfigTab'):
        QWidget.__init__(self, parent, name)
        self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
        self.textbrowser = KTextBrowser(self)
        self.grid.addWidget(self.textbrowser, 0, 0)
        self.button = KPushButton(self)
        self.button.setText('test get_config')
        self.grid.addWidget(self.button, 1, 0)
        
    def set_config(self, cfg):
        tfile = StringIO()
        cfg.write(tfile)
        tfile.seek(0)
        text = tfile.read()
        self.textbrowser.setText(text)
Exemplo n.º 7
0
 def __init__(self, parent, name='TestConfigTab'):
     QWidget.__init__(self, parent, name)
     self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
     self.textbrowser = KTextBrowser(self)
     self.grid.addWidget(self.textbrowser, 0, 0)
     self.button = KPushButton(self)
     self.button.setText('test get_config')
     self.grid.addWidget(self.button, 1, 0)
class AuditGameDialog(BaseDialogWindow):
    def __init__(self, parent, name='AuditGameDialog'):
        BaseDialogWindow.__init__(self, parent, name=name)
        #self.grid = QGridLayout(self, 2, 1, 5, 7)
        self.frame = KTextBrowser(self)
        self.frame.setNotifyClick(True)
        self.frame.setSource = self.setSource
        self.doc = AuditGameDocument(self.app)
        #self.grid.addWidget(self.frame, 0, 0)
        self.progress_label = QLabel(self)
        self.progress = KProgress(self)
        #self.grid.addWidget(self.progress, 1, 0)
        self.setMainWidget(self.frame)
        layout = self.layout()
        # we use insertWidget instead of
        # addWidget here so the widgets
        # are above the dialog buttons
        # self frame should be at 0 index in the layout
        # we set the progress and label below this
        layout.insertWidget(1, self.progress)
        # inserting into index 1 here knocks self.progress down to 2
        layout.insertWidget(1, self.progress_label)
        # disable and hide extra buttons
        self.enableButtonApply(False)
        self.showButtonApply(False)
        self.enableButtonCancel(False)
        self.showButtonCancel(False)
        # the dialog should be a little taller than what
        # it defaults to
        self.resize(0, 300)
        
    def report_md5check(self, filename, count):
        self.progress_label.setText('checking %s' % filename)
        self.progress.setProgress(count)
        self.app.processEvents()
    
    def audit_game(self, name, from_install=True, time='now'):
        filehandler = self.app.make_new_fileshandler()
        total = len(filehandler.datahandler.get_installed_files(name))
        self.progress.setTotalSteps(total)
        filehandler.archivehelper.report_installed_file_handled = self.report_md5check
        unchanged, changed, extra = filehandler.audit_game_files(name,
                                                                 from_install=from_install, time=time)
        self.doc.set_info(unchanged, changed, extra)
        self.frame.setText(self.doc.output())
        self.progress_label.setText('Audit Completed')

    def setSource(self, url):
        print url
        if url == 'show':
            self.doc.append_unchanged_files()
            self.frame.setText(self.doc.output())
Exemplo n.º 9
0
 def __init__(self, parent, name='BaseLogBrowser'):
     KTextBrowser.__init__(self, parent, name)
     self.setTextFormat(self.LogText)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_logtext)
     self.resume_logging()
Exemplo n.º 10
0
 def setMimeSourceFactory(self, factory=None):
     if factory is None:
         self.mimes = MimeSources()
     else:
         self.mimes = factory
     KTextBrowser.setMimeSourceFactory(self, self.mimes)
Exemplo n.º 11
0
 def __init__(self, parent, docobject):
     KTextBrowser.__init__(self, parent)
     self.setMimeSourceFactory()
     self.app = get_application_pointer()
     self.doc = docobject(self.app)
     self.setNotifyClick(True)
Exemplo n.º 12
0
 def setMimeSourceFactory(self, factory=None):
     if factory is None:
         self.mimes = MimeSources()
     else:
         self.mimes = factory
     KTextBrowser.setMimeSourceFactory(self, self.mimes)
Exemplo n.º 13
0
 def __init__(self, parent, docobject):
     KTextBrowser.__init__(self, parent)
     self.setMimeSourceFactory()
     self.app = get_application_pointer()
     self.doc = docobject(self.app)
     self.setNotifyClick(True)
 def __init__(self, parent, name='InfoBrowser'):
     KTextBrowser.__init__(self, parent, name)
     self._init_common()
     self.setNotifyClick(True)
     self.dialog_parent = self
Exemplo n.º 15
0
 def __init__(self, parent, name='BaseLogBrowser'):
     KTextBrowser.__init__(self, parent, name)
     self.setTextFormat(self.LogText)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_logtext)
     self.resume_logging()