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


Python PThread.get方法代码示例

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


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

示例1: WebDialog

# 需要导入模块: from pds.thread import PThread [as 别名]
# 或者: from pds.thread.PThread import get [as 别名]
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,代码行数:103,代码来源:webdialog.py

示例2: WebDialog

# 需要导入模块: from pds.thread import PThread [as 别名]
# 或者: from pds.thread.PThread import get [as 别名]
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,代码行数:103,代码来源:webdialog.py

示例3: WebDialog

# 需要导入模块: from pds.thread import PThread [as 别名]
# 或者: from pds.thread.PThread import get [as 别名]
class WebDialog(PAbstractBox, Ui_WebDialog):
    finished = pyqtSignal()
    
    def __init__(self, parent):
        PAbstractBox.__init__(self, parent)
        self.setupUi(self)

        self.iface = backend.pm.Iface()   #parent.iface

        # PDS Settings
        self._animation = 1
        self._duration = 1
        self.enableOverlay()
        self.setOverlayOpacity(150)
        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://appinfo.pisilinux.org'
        self.cancelButton.clicked.connect(self._hide)
        self.cancelButton.setIcon(QIcon.fromTheme("cancel"))

        # 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(QtWebKitWidgets.QWebPage.DelegateAllLinks)
        self.webView.page().linkClicked.connect(self.showFullImage)

        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.noconnection.hide()
        self.parent = parent
        
    def destroyed(self):
        self.finished.emit()

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

    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):
        files=self.iface.getPackageFiles(str(self.packageName.text()))
        self.filesList.addItems(files)
        self.filesList.sortItems()
        return files #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=''):
        package = str(QVariant.value(package))
        summary = str(QVariant.value(summary))
        description = str(QVariant.value(description))
        
        self.packageName.setText(package)
        self.filesList.clear()
        
        
        self.tabWidget.insertTab(0, self.packageFiles, _translate("Packaga Manager",'Package Files'))
        self.tabWidget.currentChanged.connect(self._tabSwitched)
#.........这里部分代码省略.........
开发者ID:PisiLinuxNew,项目名称:package-manager,代码行数:103,代码来源:webdialog.py


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