当前位置: 首页>>代码示例>>Python>>正文


Python thread.PThread类代码示例

本文整理汇总了Python中pds.thread.PThread的典型用法代码示例。如果您正苦于以下问题:Python PThread类的具体用法?Python PThread怎么用?Python PThread使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PThread类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, state, parent):
        PAbstractBox.__init__(self, parent)
        self.setupUi(self)
        self.state = state
        # PDS Settings
        self._animation = 1
        self._duration = 400
        self.enableOverlay()
        self._disable_parent_in_shown = True
        self.webView.hide()
      
        #Url list for package pisi source files
        global packageUrlList
        packageUrlList = []
        
        self._as = 'http://youtube.googleapis.com/v'
        self.cancelButton.clicked.connect(self._hide)
        self.cancelButton.setIcon(KIcon("dialog-close"))

        self.packageHomepage.clicked.connect(self.openWebsite)
        self.packagePisiSource.clicked.connect(self.openPisiSource)
        #self.wdInstallButton.clicked.connect(self.showBasket)
        # Hide Scrollbars and context menu in webview
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
        self.webView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        self.webView.page().linkClicked.connect(self.showFullImage)

        self.tabWidget.removeTab(0)

        self._filesThread = PThread(self, self.getFiles, self.getFilesFinished)
        self.filterLine.setListWidget(self.filesList)
        self.noconnection.hide()
        self.parent = parent
开发者ID:aslanon,项目名称:pisilinux,代码行数:35,代码来源:webdialog.py

示例2: __init__

    def __init__(self, parent = None):
        QWidget.__init__(self, parent)

        self.setupUi(self)
        self.parent = parent

        self._selectedGroups = []
        self._preexceptions  = []
        self._postexceptions = []

        self.state = StateManager(self)
        self.currentState = None
        self.completer = None
        self._updatesCheckedOnce = False

        #set style
        self._style = "/usr/share/kde4/apps/package-manager/data/style.qss"
        self.setStyleSheet(file(self._style).read())

        # Search Thread
        self._searchThread = PThread(self, self.startSearch, self.searchFinished)

        self.statusUpdater = StatusUpdater()
        self.basket = BasketDialog(self.state, self.parent)
        self._postexceptions.append(lambda: self.basket.setActionEnabled(True))
        self.searchButton.setIcon(KIcon("edit-find"))
        self.initializeUpdateTypeList()

        self.morewidgets = MoreWidgets(self.state, self.parent)
        self._postexceptions.append(lambda: self.morewidgets.setActionEnabled(True))
        self.morewidgets._show()

        self.webdialog = WebDialog(self.state, self.parent)

        model = PackageModel(self)
        proxy = PackageProxy(self)
        proxy.setSourceModel(model)
        self.packageList.setModel(proxy)
        self.packageList.setItemDelegate(PackageDelegate(self, self.parent))
        self.packageList.setColumnWidth(0, 32)

        self.connect(self.packageList.model(), SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.statusChanged)
        self.connect(self.packageList, SIGNAL("updateRequested()"), self.initialize)
        self.connect(self.morewidgets.randomPackageList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.showWebdialog)

        self.updateSettings()
        self.setActionButton()

        self.operation = OperationManager(self.state)

        self.progressDialog = ProgressDialog(self.state, self.parent)
        self._preexceptions.append(self.progressDialog._hide)
        self.progressDialog.registerFunction(FINISHED, lambda: self.parent.statusBar().setVisible(not self.progressDialog.isVisible()))
        self.progressDialog.registerFunction(OUT, lambda: self.parent.statusBar().show())
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()
        self.pdsMessageBox = PMessageBox(self.content)
开发者ID:aslanon,项目名称:pisilinux,代码行数:58,代码来源:mainwidget.py

示例3: __init__

    def __init__(self, parent = None):
        super(MainWidget, self).__init__(parent)
        
        self.setupUi(self)
        self.parent = parent
        
        self._selectedGroups = []
        self._preexceptions  = []
        self._postexceptions = []

        self.state = StateManager(self)
        self.currentState = None
        self.completer = None
        self._updatesCheckedOnce = False
        
        
        # Search Thread
        self._searchThread = PThread(self, self.startSearch, self.searchFinished)

        self.statusUpdater = StatusUpdater()
        self.basket = BasketDialog(self.state, self.parent)
        self._postexceptions.append(lambda: self.basket.setActionEnabled(True))
        self.searchButton.setIcon(KIcon(("edit-find", "find")))
        self.initializeUpdateTypeList()

        model = PackageModel(self)
        proxy = PackageProxy(self)
        proxy.setSourceModel(model)
        self.packageList.setModel(proxy)
        self.packageList.setItemDelegate(PackageDelegate(self, self.parent))
        self.packageList.setColumnWidth(0, 32)
        
        
        
        self.packageList.dataChanged[QModelIndex,QModelIndex].connect(self.statusChanged)
        
        self.packageList.updateRequested.connect(self.initialize)

        self.updateSettings()
        self.setActionButton()

        self.operation = OperationManager(self.state)

        self.progressDialog = ProgressDialog(self.state, self.parent)
        self._preexceptions.append(self.progressDialog._hide)
        self.progressDialog.registerFunction(FINISHED, lambda: self.parent.statusBar().setVisible(not self.progressDialog.isVisible()))
        self.progressDialog.registerFunction(OUT, lambda: self.parent.statusBar().show())
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()
        self.pdsMessageBox = PMessageBox(self.content)
开发者ID:hrngultekin,项目名称:package-manager,代码行数:51,代码来源:mainwidget.py

示例4: __init__

    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_RootPassWidget()
        self.ui.setupUi(self)
        self.intf = ctx.interface

        self.host_valid = True
        self.pass_valid = False

        if ctx.flags.install_type == ctx.STEP_DEFAULT:
            self.pthread = PThread(self, self.startInit, self.dummy)

        self.pds_messagebox = PMessageBox(self)
        self.pds_messagebox.enableOverlay()

        self.ui.pass1.textChanged[str].connect(self.slotTextChanged)
        self.ui.pass2.textChanged[str].connect(self.slotTextChanged)
        self.ui.pass2.returnPressed.connect(self.slotReturnPressed)
        self.ui.hostname.textChanged[str].connect(self.slotHostnameChanged)
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:19,代码来源:ScrAdmin.py

示例5: __init__

    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_RootPassWidget()
        self.ui.setupUi(self)
        self.intf = ctx.interface

        self.host_valid = True
        self.pass_valid = False

        if ctx.flags.install_type in [ctx.STEP_DEFAULT, ctx.STEP_LIVE]:
            self.pthread = PThread(self, self.startInit, self.dummy)

        self.pds_messagebox = PMessageBox(self)
        self.pds_messagebox.enableOverlay()

        self.connect(self.ui.pass1, SIGNAL("textChanged(const QString &)"),
                     self.slotTextChanged)
        self.connect(self.ui.pass2, SIGNAL("textChanged(const QString &)"),
                     self.slotTextChanged)
        self.connect(self.ui.pass2, SIGNAL("returnPressed()"),
                     self.slotReturnPressed)
        self.connect(self.ui.hostname, SIGNAL("textChanged(const QString &)"),
                     self.slotHostnameChanged)
开发者ID:SamiBabat,项目名称:playground,代码行数:23,代码来源:ScrAdmin.py

示例6: __init__

    def __init__(self, parent):
        PAbstractBox.__init__(self, parent)
        self.setupUi(self)

        self.iface = parent.iface

        # PDS Settings
        self._animation = 1
        self._duration = 400
        self.enableOverlay()
        self._disable_parent_in_shown = True

        self.registerFunction(IN, lambda: parent.statusBar().hide())
        self.registerFunction(FINISHED, lambda: parent.statusBar().setVisible(not self.isVisible()))
        self._as = 'http://onurguzel.com/appinfo'
        self.cancelButton.clicked.connect(self._hide)
        self.cancelButton.setIcon(KIcon("dialog-close"))

        # Hide Scrollbars and context menu in webview
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)

        self.webView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        self.webView.page().linkClicked.connect(self.redirectLinks)

        self.tabWidget.removeTab(0)

        self.busy = QProgressIndicator(self, "white")
        self.busy.setMaximumSize(QSize(48, 48))
        self.webLayout.addWidget(self.busy)
        self.busy.hide()

        self._filesThread = PThread(self, self.getFiles, self.getFilesFinished)
        self.filterLine.setListWidget(self.filesList)
        self.noconnection.hide()
        self.parent = parent
开发者ID:SamiBabat,项目名称:playground,代码行数:37,代码来源:webdialog.py

示例7: MainWidget

class MainWidget(QWidget, PM, Ui_MainWidget):
    def __init__(self, parent = None):
        QWidget.__init__(self, parent)

        self.setupUi(self)
        self.parent = parent

        self._selectedGroups = []
        self._preexceptions  = []
        self._postexceptions = []

        self.state = StateManager(self)
        self.currentState = None
        self.completer = None
        self._updatesCheckedOnce = False

        #set style
        self._style = "/usr/share/kde4/apps/package-manager/data/style.qss"
        self.setStyleSheet(file(self._style).read())

        # Search Thread
        self._searchThread = PThread(self, self.startSearch, self.searchFinished)

        self.statusUpdater = StatusUpdater()
        self.basket = BasketDialog(self.state, self.parent)
        self._postexceptions.append(lambda: self.basket.setActionEnabled(True))
        self.searchButton.setIcon(KIcon("edit-find"))
        self.initializeUpdateTypeList()

        self.morewidgets = MoreWidgets(self.state, self.parent)
        self.morewidgets._show()

        self.webdialog = WebDialog(self.state, self.parent)

        model = PackageModel(self)
        proxy = PackageProxy(self)
        proxy.setSourceModel(model)
        self.packageList.setModel(proxy)
        self.packageList.setItemDelegate(PackageDelegate(self, self.parent))
        self.packageList.setColumnWidth(0, 32)

        self.connect(self.packageList.model(), SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.statusChanged)
        self.connect(self.packageList, SIGNAL("updateRequested()"), self.initialize)
        self.connect(self.morewidgets.randomPackageList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.showWebdialog)

        self.updateSettings()
        self.setActionButton()

        self.operation = OperationManager(self.state)

        self.progressDialog = ProgressDialog(self.state, self.parent)
        self._preexceptions.append(self.progressDialog._hide)
        self.progressDialog.registerFunction(FINISHED, lambda: self.parent.statusBar().setVisible(not self.progressDialog.isVisible()))
        self.progressDialog.registerFunction(OUT, lambda: self.parent.statusBar().show())
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()
        self.pdsMessageBox = PMessageBox(self.content)

    def connectMainSignals(self):
        self.connect(self.actionButton, SIGNAL("clicked()"), self.showBasket)
        self.connect(self.buttonMore, SIGNAL("clicked()"), self.showMoreWidgets)
        self.connect(self.checkUpdatesButton, SIGNAL("clicked()"), self.state.updateRepoAction)
        self.connect(self.searchButton, SIGNAL("clicked()"), self.searchActivated)
        self.connect(self.searchLine, SIGNAL("textEdited(const QString&)"), self.searchLineChanged)
        self.connect(self.searchLine, SIGNAL("returnPressed()"), self.searchActivated)
        self.connect(self.searchLine, SIGNAL("clearButtonClicked()"), self.groupFilter)
        self.connect(self.typeCombo, SIGNAL("activated(int)"), self.typeFilter)
        self.connect(self.stateTab, SIGNAL("currentChanged(int)"), self.switchState)
        self.connect(self.groupList, SIGNAL("groupChanged()"), self.groupFilter)
        self.connect(self.groupList, SIGNAL("groupChanged()"), lambda:self.searchButton.setEnabled(False))
        self.connect(self.packageList.select_all, SIGNAL("clicked(bool)"), self.toggleSelectAll)
        self.connect(self.statusUpdater, SIGNAL("selectedInfoChanged(int, QString, int, QString)"), self.emitStatusBarInfo)
        self.connect(self.statusUpdater, SIGNAL("selectedInfoChanged(QString)"), lambda message: self.emit(SIGNAL("selectionStatusChanged(QString)"), message))
        self.connect(self.statusUpdater, SIGNAL("finished()"), self.statusUpdated)

    def initialize(self):
        waitCursor()
        self.searchLine.clear()
        self._started = False
        self._last_packages = None
        self.state.reset()
        self.initializePackageList()
        self.initializeGroupList()
        self.initializeStatusUpdater()
        self.statusChanged()
        self._selectedGroups = []
        self.packageList.select_all.setChecked(False)
        self.initializeBasket()
        self.searchLine.setFocus(True)
        if self.currentState == self.state.UPGRADE:
            if self.groupList.count() == 0:
                QTimer.singleShot(0, \
                lambda: self.pdsMessageBox.showMessage(i18n("All packages are up to date"), icon = "games-endturn"))
        if self.groupList.count() > 0:
            if self.state.inUpgrade():
                self.pdsMessageBox.hideMessage(force = True)
        restoreCursor()

    def initializeStatusUpdater(self):
#.........这里部分代码省略.........
开发者ID:aslanon,项目名称:pisilinux,代码行数:101,代码来源:mainwidget.py

示例8: __init__

    def __init__(self, parent = None, step = 1):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        self.logger = SimpleLogger()
        self.log = self.logger.log

        self.target_repo = REPO_TEMPLATE % 'stable'
        self.iface = Iface(self)

        self.connect(self.iface, SIGNAL("notify(PyQt_PyObject)"), self.showMessage)

        self.msgbox = PMessageBox(self)
        self.msgbox.setStyleSheet("color:white;")
        self.msgbox.enableOverlay()
                                                          # Just for Fun :)
        self.pageWidget = QPageWidget(self.widget_screens)# , direction = 'ttb')
        self.layout.addWidget(self.pageWidget)

        self.button_next.clicked.connect(self.pageWidget.next)
        self.button_previous.clicked.connect(self.pageWidget.prev)
        self.button_cancel.clicked.connect(self.reject)

        # Threads
        self.thread_step_1 = PThread(self, self.step_1_start, self.step_1_end)
        self.thread_step_2 = PThread(self, self.step_2_start, self.step_2_end)
        self.thread_step_3 = PThread(self, self.step_3_start, self.step_3_end)

        # Update Page Title
        self.connect(self.pageWidget, SIGNAL("currentChanged()"), lambda:\
                     self.label_header.setText(self.pageWidget.getCurrentWidget().title))

        self.current_step = step

        if step == 1:
            self.thread_check = PThread(self, self.findMissingPackages, self.showResults)

            # Welcome
            self.pageWidget.createPage(
                    getWidget(ui_screen_1, _("Welcome to Upgrade Manager...")))

            # Repo Selection
            self.pageWidget.createPage(
                    getWidget(ui_screen_2, _("Select Upgrade Repository...")))

            # Check Results Page
            self.pageWidget.createPage(
                    getWidget(ui_screen_3, _("Checking your system...")),
                    inMethod = self.checkSystem, outMethod = self.hideMessage)

            resultWidget = self.pageWidget.getWidget(2).ui
            resultWidget.widget.hide()

            def updateButtons():
                if self.button_next.text() == _("Next"):
                    self.button_next.setText(_("Yes, Upgrade"))
                    self.button_previous.setText(_("Cancel"))
                    self.button_cancel.hide()
                else:
                    self.button_next.setText(_("Next"))
                    self.button_previous.setText(_("Previous"))
                    self.button_cancel.show()

            # Last Question
            self.pageWidget.createPage(
                    getWidget(ui_screen_4, ""), inMethod = updateButtons,
                                                outMethod= updateButtons)
        self._step_counter = 0

        # Progress Screen
        self.pageWidget.createPage(
                getWidget(ui_screen_5, _("Upgrading the system...")), inMethod = self.upgradeStep_1)

        # Shortcut for Progress Screen UI
        # Get the last added page as progress page
        # After the first step completed, um will use just this page !
        self.ps = self.pageWidget.getWidget(self.pageWidget.count() - 1).ui

        # Busy indicator to Progress Screen
        self.ps.busy = QProgressIndicator(self)
        self.ps.busy.hide()
        self.ps.layout.addWidget(self.ps.busy)

        if step == 2:
            self.upgradeStep_2()
        elif step == 3:
            self.upgradeStep_3()
开发者ID:muratongan,项目名称:Pardus,代码行数:87,代码来源:gui.py

示例9: UmMainScreen

class UmMainScreen(QDialog, ui_mainscreen.Ui_UpgradeManager):

    def __init__(self, parent = None, step = 1):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        self.logger = SimpleLogger()
        self.log = self.logger.log

        self.target_repo = REPO_TEMPLATE % 'stable'
        self.iface = Iface(self)

        self.connect(self.iface, SIGNAL("notify(PyQt_PyObject)"), self.showMessage)

        self.msgbox = PMessageBox(self)
        self.msgbox.setStyleSheet("color:white;")
        self.msgbox.enableOverlay()
                                                          # Just for Fun :)
        self.pageWidget = QPageWidget(self.widget_screens)# , direction = 'ttb')
        self.layout.addWidget(self.pageWidget)

        self.button_next.clicked.connect(self.pageWidget.next)
        self.button_previous.clicked.connect(self.pageWidget.prev)
        self.button_cancel.clicked.connect(self.reject)

        # Threads
        self.thread_step_1 = PThread(self, self.step_1_start, self.step_1_end)
        self.thread_step_2 = PThread(self, self.step_2_start, self.step_2_end)
        self.thread_step_3 = PThread(self, self.step_3_start, self.step_3_end)

        # Update Page Title
        self.connect(self.pageWidget, SIGNAL("currentChanged()"), lambda:\
                     self.label_header.setText(self.pageWidget.getCurrentWidget().title))

        self.current_step = step

        if step == 1:
            self.thread_check = PThread(self, self.findMissingPackages, self.showResults)

            # Welcome
            self.pageWidget.createPage(
                    getWidget(ui_screen_1, _("Welcome to Upgrade Manager...")))

            # Repo Selection
            self.pageWidget.createPage(
                    getWidget(ui_screen_2, _("Select Upgrade Repository...")))

            # Check Results Page
            self.pageWidget.createPage(
                    getWidget(ui_screen_3, _("Checking your system...")),
                    inMethod = self.checkSystem, outMethod = self.hideMessage)

            resultWidget = self.pageWidget.getWidget(2).ui
            resultWidget.widget.hide()

            def updateButtons():
                if self.button_next.text() == _("Next"):
                    self.button_next.setText(_("Yes, Upgrade"))
                    self.button_previous.setText(_("Cancel"))
                    self.button_cancel.hide()
                else:
                    self.button_next.setText(_("Next"))
                    self.button_previous.setText(_("Previous"))
                    self.button_cancel.show()

            # Last Question
            self.pageWidget.createPage(
                    getWidget(ui_screen_4, ""), inMethod = updateButtons,
                                                outMethod= updateButtons)
        self._step_counter = 0

        # Progress Screen
        self.pageWidget.createPage(
                getWidget(ui_screen_5, _("Upgrading the system...")), inMethod = self.upgradeStep_1)

        # Shortcut for Progress Screen UI
        # Get the last added page as progress page
        # After the first step completed, um will use just this page !
        self.ps = self.pageWidget.getWidget(self.pageWidget.count() - 1).ui

        # Busy indicator to Progress Screen
        self.ps.busy = QProgressIndicator(self)
        self.ps.busy.hide()
        self.ps.layout.addWidget(self.ps.busy)

        if step == 2:
            self.upgradeStep_2()
        elif step == 3:
            self.upgradeStep_3()

    # Step 1 Method
    def checkSystem(self):
        self.showMessage(_("Checking your system..."))
        self.log("CHECKING CURRENT PACKAGES", "GUI")
        repoWidget = self.pageWidget.getWidget(1).ui

        for repo in ('stable', 'devel', 'testing'):
            if getattr(repoWidget, repo).isChecked():
                self.target_repo = REPO_TEMPLATE % repo

#.........这里部分代码省略.........
开发者ID:muratongan,项目名称:Pardus,代码行数:101,代码来源:gui.py

示例10: Widget


#.........这里部分代码省略.........
        # Countries of the selected continent
        countries = self.tz_dict[str(continent)]

        self.ui.countryList.clear()

        for country, zone in countries:
            self.ui.countryList.addItem(country, zone)
            self.countries.append(country)



    def dateChanged(self):
        self.is_date_changed = True

    def timerStop(self):
        if self.from_time_updater:
            return
        # Human action detected; stop the timer.
        self.timer.stop()

    def updateClock(self):

        # What time is it ?
        cur = QTime.currentTime()

        self.from_time_updater = True
        self.ui.timeEdit.setTime(cur)
        self.from_time_updater = False

    def shown(self):
        self.timer.start(1000)

        if ctx.flags.install_type == ctx.STEP_BASE:
            self.pthread = PThread(self, self.startInit, self.dummy)

    def dummy(self):
        pass

    def setTime(self):
        ctx.interface.informationWindow.update(_("Adjusting time settings"))
        date = self.ui.calendarWidget.date()
        time = self.ui.timeEdit.time()
        args = "%02d%02d%02d%02d%04d.%02d" % (date.month(), date.day(),
                                              time.hour(), time.minute(),
                                              date.year(), time.second())


        # Set current date and time
        ctx.logger.debug("Date/Time setting to %s" % args)
        yali.util.run_batch("date", [args])

        # Sync date time with hardware
        ctx.logger.debug("YALI's time is syncing with the system.")
        yali.util.run_batch("hwclock", ["--systohc"])
        ctx.interface.informationWindow.hide()

    def execute(self):
        if not self.timer.isActive() or self.is_date_changed:
            QTimer.singleShot(500, self.setTime)
            self.timer.stop()

        index = self.ui.countryList.currentIndex()
        ctx.installData.timezone = self.ui.countryList.itemData(index)
        ctx.logger.debug("Time zone selected as %s " % ctx.installData.timezone)

        if ctx.flags.install_type == ctx.STEP_BASE:
开发者ID:hrngultekin,项目名称:yali-family,代码行数:67,代码来源:ScrDateTime.py

示例11: shown

    def shown(self):
        self.timer.start(1000)

        if ctx.flags.install_type == ctx.STEP_BASE:
            self.pthread = PThread(self, self.startInit, self.dummy)
开发者ID:hrngultekin,项目名称:yali-family,代码行数:5,代码来源:ScrDateTime.py

示例12: MainWidget

class MainWidget(QWidget, PM, Ui_MainWidget):
    # Signal Emits
    updatingStatus = pyqtSignal()
    repositoriesUpdated = pyqtSignal()
    selectionStatusChanged = pyqtSignal([str])
    finished = pyqtSignal()
    cleanUp = pyqtSignal()
    
    def __init__(self, parent = None):
        super(MainWidget, self).__init__(parent)
        
        self.setupUi(self)
        self.parent = parent
        
        self._selectedGroups = []
        self._preexceptions  = []
        self._postexceptions = []

        self.state = StateManager(self)
        self.currentState = None
        self.completer = None
        self._updatesCheckedOnce = False
        
        
        # Search Thread
        self._searchThread = PThread(self, self.startSearch, self.searchFinished)

        self.statusUpdater = StatusUpdater()
        self.basket = BasketDialog(self.state, self.parent)
        self._postexceptions.append(lambda: self.basket.setActionEnabled(True))
        self.searchButton.setIcon(KIcon(("edit-find", "find")))
        self.initializeUpdateTypeList()

        model = PackageModel(self)
        proxy = PackageProxy(self)
        proxy.setSourceModel(model)
        self.packageList.setModel(proxy)
        self.packageList.setItemDelegate(PackageDelegate(self, self.parent))
        self.packageList.setColumnWidth(0, 32)
        
        
        
        self.packageList.dataChanged[QModelIndex,QModelIndex].connect(self.statusChanged)
        
        self.packageList.updateRequested.connect(self.initialize)

        self.updateSettings()
        self.setActionButton()

        self.operation = OperationManager(self.state)

        self.progressDialog = ProgressDialog(self.state, self.parent)
        self._preexceptions.append(self.progressDialog._hide)
        self.progressDialog.registerFunction(FINISHED, lambda: self.parent.statusBar().setVisible(not self.progressDialog.isVisible()))
        self.progressDialog.registerFunction(OUT, lambda: self.parent.statusBar().show())
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()
        self.pdsMessageBox = PMessageBox(self.content)
        

    def connectMainSignals(self):
        self.actionButton.clicked.connect(self.showBasket)
        self.checkUpdatesButton.clicked.connect(self.state.updateRepoAction)
        self.searchButton.clicked.connect(self.searchActivated)
        self.searchLine.textEdited[str].connect(self.searchLineChanged)
        self.searchLine.returnPressed.connect(self.searchActivated)
        
        self.searchLine.textChanged[str].connect(self.slotSearchLineClear)       
        
        self.typeCombo.activated[int].connect(self.typeFilter)
        self.stateTab.currentChanged[int].connect(self.switchState)
        self.groupList.groupChanged.connect(self.groupFilter)
        self.groupList.groupChanged.connect(lambda:self.searchButton.setEnabled(False))
        self.packageList.select_all.clicked[bool].connect(self.toggleSelectAll)
        self.packageList.itemDelegate().packageSelected[bool].connect(self.toggleSelect)
        self.statusUpdater.selectedInfoChanged[int,str,int,str].connect(self.emitStatusBarInfo)
        self.statusUpdater.selectedInfoChanged[str].connect(lambda message: self.selectionStatusChanged[str].emit(message))
        self.statusUpdater.finished.connect(self.statusUpdated)

    def initialize(self):
        waitCursor()
        self.searchLine.clear()
        self._started = False
        self._last_packages = None
        self.state.reset()
        self.initializePackageList()
        self.initializeGroupList()
        self.initializeStatusUpdater()
        self.statusChanged()
        self._selectedGroups = []
        self.packageList.select_all.setChecked(False)
        self.initializeBasket()
        self.searchLine.setFocus(True)
        if self.currentState == self.state.UPGRADE:
            if self.groupList.count() == 0:
                QTimer.singleShot(0, \
                lambda: self.pdsMessageBox.showMessage(_translate("Packaga Manager","All packages are up to date"), icon = "info"))
        if self.groupList.count() > 0:
            if self.state.inUpgrade():
#.........这里部分代码省略.........
开发者ID:hrngultekin,项目名称:package-manager,代码行数:101,代码来源:mainwidget.py

示例13: WebDialog

class WebDialog(PAbstractBox, Ui_WebDialog):
    def __init__(self, parent):
        PAbstractBox.__init__(self, parent)
        self.setupUi(self)

        self.iface = parent.iface

        # PDS Settings
        self._animation = 1
        self._duration = 400
        self.enableOverlay()
        self._disable_parent_in_shown = True

        self.registerFunction(IN, lambda: parent.statusBar().hide())
        self.registerFunction(FINISHED, lambda: parent.statusBar().setVisible(not self.isVisible()))
        self._as = 'http://onurguzel.com/appinfo'
        self.cancelButton.clicked.connect(self._hide)
        self.cancelButton.setIcon(KIcon("dialog-close"))

        # Hide Scrollbars and context menu in webview
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)

        self.webView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        self.webView.page().linkClicked.connect(self.redirectLinks)

        self.tabWidget.removeTab(0)

        self.busy = QProgressIndicator(self, "white")
        self.busy.setMaximumSize(QSize(48, 48))
        self.webLayout.addWidget(self.busy)
        self.busy.hide()

        self._filesThread = PThread(self, self.getFiles, self.getFilesFinished)
        self.filterLine.setListWidget(self.filesList)
        self.noconnection.hide()
        self.parent = parent

    def redirectLinks(self, url):
        if url.hasFragment():
            if url.fragment() == 'login':
                self.showLogin()
        else:
            PreviewDialog(self, url)

    def showLogin(self):
        self._hide()
        self.parent.settingsDialog.show()
        self.parent.settingsDialog.tabWidget.setCurrentIndex(4)

    def showPage(self, addr):
        if network_available():
            self.webView.load(QUrl(addr))
        else:
            self._sync_template(status = False)
        self.animate(start = BOTCENTER, stop = MIDCENTER)

    def getFiles(self):
        return self.iface.getPackageFiles(str(self.packageName.text()))

    def getFilesFinished(self):
        self.filesList.addItems(self._filesThread.get())
        self.filesList.sortItems()

    def _tabSwitched(self, index):
        if index == 0 and self.tabWidget.count() > 1:
            if self.filesList.count() == 0:
                self._filesThread.start()

    def _sync_template(self, status, package = '', summary = '', description = ''):
        def _replace(key, value):
            self.webView.page().mainFrame().evaluateJavaScript(\
                    '%s.innerHTML="%s";' % (key, value))

        self.busy.hide()
        self.busy.stopAnimation()

        if status:
            _replace('title', package)
            _replace('summary', summary)
            _replace('description', description)
            self.webWidget.show()
            self.noconnection.hide()
        else:
            self.noconnection.show()
            self.webWidget.hide()

        reset_proxy_settings()

    def showPackageDetails(self, package, installed, summary='', description=''):
        self.packageName.setText(package)
        self.key = config.PMConfig().getOpenDesktopKey()

        self.filesList.clear()
        self.webView.loadFinished.connect(lambda x: \
                self._sync_template(x, package, summary, description))

        if network_available():
            set_proxy_settings()
#.........这里部分代码省略.........
开发者ID:SamiBabat,项目名称:playground,代码行数:101,代码来源:webdialog.py

示例14: Widget

class Widget(QWidget, ScreenWidget):
    name = "admin"
    finished=pyqtSignal()
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_RootPassWidget()
        self.ui.setupUi(self)
        self.intf = ctx.interface

        self.host_valid = True
        self.pass_valid = False

        if ctx.flags.install_type == ctx.STEP_DEFAULT:
            self.pthread = PThread(self, self.startInit, self.dummy)

        self.pds_messagebox = PMessageBox(self)
        self.pds_messagebox.enableOverlay()

        self.ui.pass1.textChanged[str].connect(self.slotTextChanged)
        self.ui.pass2.textChanged[str].connect(self.slotTextChanged)
        self.ui.pass2.returnPressed.connect(self.slotReturnPressed)
        self.ui.hostname.textChanged[str].connect(self.slotHostnameChanged)

    def update(self):
        if self.host_valid and self.pass_valid:
            ctx.mainScreen.enableNext()
        else:
            ctx.mainScreen.disableNext()

    def shown(self):
        if ctx.installData.hostName:
            self.ui.hostname.setText(str(ctx.installData.hostName))
        else:
            # Use first added user's name as machine name if its exists
            release_hostname = yali.util.product_release()
            if self.ui.hostname.text() == '':
                self.ui.hostname.setText(release_hostname)

        if ctx.installData.rootPassword:
            self.ui.pass1.setText(ctx.installData.rootPassword)
            self.ui.pass2.setText(ctx.installData.rootPassword)

        self.update()
        self.checkCapsLock()
        self.ui.pass1.setFocus()


    def dummy(self):
        pass

    def execute(self):
        ctx.installData.rootPassword = unicode(self.ui.pass1.text())
        ctx.installData.hostName = unicode(self.ui.hostname.text())

        if ctx.flags.install_type == ctx.STEP_DEFAULT:
            #FIXME:Refactor dirty code
            if ctx.storageInitialized:
                disks = filter(lambda d: not d.format.hidden, ctx.storage.disks)
                if len(disks) == 1:
                    ctx.storage.clearPartDisks = [disks[0].name]
                    ctx.mainScreen.step_increment = 2
                else:
                    ctx.mainScreen.step_increment = 1
            else:
                self.pds_messagebox.setMessage(_("Storage Devices initialising..."))
                self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)
                ctx.mainScreen.step_increment = 0
                self.pthread.start()
                QTimer.singleShot(2, self.startStorageInitialize)
                return False

        return True

    def startInit(self):
        self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)

    def startStorageInitialize(self):
        ctx.storageInitialized = yali.storage.initialize(ctx.storage, ctx.interface)
        self.initFinished()

    def initFinished(self):
        self.pds_messagebox.animate(start=CURRENT, stop=CURRENT, direction=OUT)
        disks = filter(lambda d: not d.format.hidden, ctx.storage.disks)
        if ctx.storageInitialized:
            if len(disks) == 1:
                ctx.storage.clearPartDisks = [disks[0].name]
                ctx.mainScreen.step_increment = 2
            else:
                ctx.mainScreen.step_increment = 1
            ctx.mainScreen.slotNext(dry_run=True)
            self.finished.emit()
        else:
            ctx.mainScreen.enableBack()

    def setCapsLockIcon(self, child):
        if type(child) == QLineEdit:
            if pardus.xorg.capslock.isOn():
                child.setStyleSheet("""QLineEdit {
                        background-image: url(:/gui/pics/caps.png);
                        background-repeat: no-repeat;
#.........这里部分代码省略.........
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:101,代码来源:ScrAdmin.py

示例15: WebDialog

class WebDialog(PAbstractBox, Ui_WebDialog):
    def __init__(self, state, parent):
        PAbstractBox.__init__(self, parent)
        self.setupUi(self)
        self.state = state
        self.iface = parent.iface
        # PDS Settings
        self._animation = 1
        self._duration = 400
        self.enableOverlay()
        self._disable_parent_in_shown = True
        self.webView.hide()
      
        #Url list for package pisi source files
        global packageUrlList
        packageUrlList = []
        
        self.registerFunction(IN, lambda: parent.statusBar().hide())
        self.registerFunction(FINISHED, lambda: parent.statusBar().setVisible(not self.isVisible()))
        self._as = 'http://youtube.googleapis.com/v'
        self.cancelButton.clicked.connect(self._hide)
        self.cancelButton.setIcon(KIcon("dialog-close"))

        self.packageHomepage.clicked.connect(self.openWebsite)
        self.packagePisiSource.clicked.connect(self.openPisiSource)
        #self.wdInstallButton.clicked.connect(self.showBasket)
        # Hide Scrollbars and context menu in webview
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        self.webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
        self.webView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        self.webView.page().linkClicked.connect(self.showFullImage)

        self.tabWidget.removeTab(0)

        self._filesThread = PThread(self, self.getFiles, self.getFilesFinished)
        self.filterLine.setListWidget(self.filesList)
        self.noconnection.hide()
        self.parent = parent


    def showFullImage(self, url):
        PreviewDialog(self, url)

    def getFiles(self):
        return self.iface.getPackageFiles(str(self.packageName.text()))

    def getFilesFinished(self):
        self.filesList.addItems(self._filesThread.get())
        self.filesList.sortItems()

    def _tabSwitched(self, index):
        if index == 0 and self.tabWidget.count() > 1:
            if self.filesList.count() == 0:
                self._filesThread.start()

    def _sync_template(self, status, package = '', summary = '', description = ''):
        def _replace(key, value):
            self.webView.page().mainFrame().evaluateJavaScript(\
                    '%s.innerHTML="%s";' % (key, value))
        if status:
            _replace('title', package)
            _replace('summary', summary)
            _replace('description', description)
            self.webWidget.show()
            self.noconnection.hide()
        else:
            self.noconnection.hide()
            self.webWidget.show()

        reset_proxy_settings()

    def openWebsite(self):
        webbrowser.open_new_tab(packageUrlList[1])
        
    def openPisiSource(self):
        webbrowser.open_new_tab(packageUrlList[0]) 
    
    def showBasket(self):
        package = [self.packageName.text()]
        print package
        self.basket.__initList(package)
        self.basket._show()
        
    def __makePath(self, path, package):
        #Package Component configure for PiSi source files url.
        #And added new urls to packageUrlList       
        global packageSourceUrl
        __make = path.split(".")
        newPath = ("/").join(__make)
        packageSourceUrl = "https://github.com/pisilinux/PisiLinux/tree/master/%s/%s" % (newPath, package)
        self.packagePisiSource.setToolTip(packageSourceUrl) 
        #packageUrlList[0] => pisi source files url
        #packageUrlList[1] => package home page url
        packageUrlList.append(packageSourceUrl)
        packageUrlList.append(self.packageHomepage.text())
        
    def showPackageDetails(self, package, installed, summary='', description='', homepage='', appIsa='', appComponent='', rate="", repository='', _icon=''):
        self.packageName.setText(package)
        self.packageSummary.setText(summary)
#.........这里部分代码省略.........
开发者ID:aslanon,项目名称:pisilinux,代码行数:101,代码来源:webdialog.py


注:本文中的pds.thread.PThread类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。