コード例 #1
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         if action in (AppActions.INSTALL, AppActions.INSTALLDEBFILE):
             if (run.get_run_command(self.app.name) == ""):
                 self.app.status = PkgStates.NORUN
                 #self.ui.btn.setText("已安装")
                 self.ui.btn.setText(_("Aldy install"))
                 self.ui.btn.setEnabled(False)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}"
                 )
                 self.ui.btnDetail.setStyleSheet(
                     "QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}"
                 )
             else:
                 self.app.status = PkgStates.RUN
                 #self.ui.btn.setText("启动")
                 self.ui.btn.setText(_("Start"))
                 self.ui.btn.setEnabled(True)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{color:white;border:0px;background-image:url('res/ncard-run-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-run-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-run-btn-3.png');}"
                 )
                 self.ui.btnDetail.setStyleSheet(
                     "QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}"
                 )
         elif action == AppActions.REMOVE:
             self.app.status = PkgStates.INSTALL
             #self.ui.btn.setText("安装")
             self.ui.btn.setText(_("Install"))
             self.ui.btn.setEnabled(True)
             self.ui.btn.setStyleSheet(
                 "QPushButton{color:white;border:0px;background-image:url('res/ncard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-install-btn-3.png');}"
             )
             self.ui.btnDetail.setStyleSheet(
                 "QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}"
             )
         elif action == AppActions.UPGRADE:
             if (run.get_run_command(self.app.name) == ""):
                 self.app.status = PkgStates.NORUN
                 #self.ui.btn.setText("已安装")
                 self.ui.btn.setText(_("Aldy install"))
                 self.ui.btn.setEnabled(False)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}"
                 )
                 self.ui.btnDetail.setStyleSheet(
                     "QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}"
                 )
             else:
                 self.app.status = PkgStates.RUN
                 #self.ui.btn.setText("启动")
                 self.ui.btn.setText(_("Start"))
                 self.ui.btn.setEnabled(True)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{color:white;border:0px;background-image:url('res/ncard-run-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-run-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-run-btn-3.png');}"
                 )
                 self.ui.btnDetail.setStyleSheet(
                     "QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}"
                 )
コード例 #2
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         if action in (AppActions.INSTALL, AppActions.INSTALLDEBFILE):
             # self.star.hide()
             # self.ui.isInstalled.setVisible(True)
             if (run.get_run_command(self.app.name) == ""):
                 self.app.status = PkgStates.NORUN
                 #self.ui.btn.setText("已安装")
                 self.ui.btn.setText(_("Aldy install"))
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}"
                 )
                 # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                 self.ui.btn.setEnabled(False)
             else:
                 self.app.status = PkgStates.RUN
                 #self.ui.btn.setText("启动")
                 self.ui.btn.setText(_("Start"))
                 self.ui.btn.setEnabled(True)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                 )
                 # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}")
         elif action == AppActions.REMOVE:
             self.app.status = PkgStates.INSTALL
             # self.star.show()
             # self.ui.isInstalled.setVisible(False)
             #self.ui.btn.setText("安装")
             self.ui.btn.setText(_("Install"))
             self.ui.btn.setEnabled(True)
             self.ui.btn.setStyleSheet(
                 "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
             )
             # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")
         elif action == AppActions.UPGRADE:
             # self.star.hide()
             # self.ui.isInstalled.setVisible(True)
             if (run.get_run_command(self.app.name) == ""):
                 self.app.status = PkgStates.NORUN
                 #self.ui.btn.setText("已安装")
                 self.ui.btn.setText(_("Aldy install"))
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}"
                 )
                 # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                 self.ui.btn.setEnabled(False)
             else:
                 self.app.status = PkgStates.RUN
                 #self.ui.btn.setText("启动")
                 self.ui.btn.setText(_("Start"))
                 self.ui.btn.setEnabled(True)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                 )
コード例 #3
0
    def slot_work_cancel(self, pkgname, action):
        if self.app.name == pkgname:

            if action == AppActions.INSTALL:
                self.app.status = PkgStates.INSTALL
                # self.star.show()
                # self.ui.isInstalled.setVisible(False)
                self.ui.btn.setText("安装")
                self.ui.btn.setEnabled(True)
                self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")
            elif action in (AppActions.REMOVE, AppActions.UPGRADE):
                # self.star.hide()
                # self.ui.isInstalled.setVisible(True)
                if(run.get_run_command(self.app.name) == ""):
                    self.app.status = PkgStates.NORUN
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setEnabled(False)
                    self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}")
                    # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                else:
                    self.ui.btn.setText("启动")
                    self.app.status = PkgStates.RUN
                    self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
                    # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}")

            elif action == AppActions.INSTALLDEBFILE:
                if(self.app.is_installed):
                    # self.star.hide()
                    # self.ui.isInstalled.setVisible(True)

                    if(run.get_run_command(self.app.name) == ""):
                        self.app.status = PkgStates.NORUN
                        self.ui.btn.setText("已安装")
                        self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}")
                        # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                        self.ui.btn.setEnabled(False)
                    else:
                        self.app.status = PkgStates.RUN
                        self.ui.btn.setText("启动")
                        self.ui.btn.setEnabled(True)
                        self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
                        # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}")
                else:
                    # star = StarWidget("small", self.app.ratings_average, self.ui.baseWidget)
                    # star.move(75, 56)
                    # init app.status
                    self.app.status = PkgStates.INSTALL
                    # self.star.show()
                    # self.ui.isInstalled.setVisible(False)
                    self.ui.btn.setText("安装")
                    self.ui.btn.setEnabled(True)
                    self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
コード例 #4
0
 def slot_work_cancel(self, pkgname, action):
     if self.app.name == pkgname:
         if action == AppActions.INSTALL:
             # self.ui.btn.setText("安装")
             self.ui.btn.setText(_("Installation"))
             self.ui.status.hide()
             self.ui.btn.setEnabled(True)
             self.ui.cbSelect.setEnabled(True)
         elif action == AppActions.REMOVE:
             if (run.get_run_command(self.app.name) == ""):
                 # self.ui.btn.setText("卸载")
                 self.ui.btn.setText(_("Uninstall"))
                 self.ui.status.show()
                 self.ui.btn.setEnabled(True)
             else:
                 #self.ui.btn.setText("启动")
                 self.ui.btn.setText(_("Start"))
                 self.ui.btn.setEnabled(True)
             self.ui.cbSelect.setEnabled(False)
         elif action == AppActions.UPGRADE:
             #self.ui.btn.setText("升级")
             self.ui.btn.setText(_("Upgrade"))
             self.ui.btn.setEnabled(True)
             self.ui.status.show()
             self.ui.cbSelect.setEnabled(True)
コード例 #5
0
 def slot_work_cancel(self, pkgname, action):
     if self.app is not None:
         if self.app.name == pkgname:
             if action == AppActions.INSTALL:
                 self.app.status = PkgStates.INSTALL
                 #self.ui.btn.setText("安装")
                 self.ui.btn.setText(_("Install"))
                 self.ui.btn.setEnabled(True)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                 )
                 # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")
             elif action in (
                     AppActions.REMOVE,
                     AppActions.UPGRADE):  #can not appear on win page
                 if (run.get_run_command(self.app.name) == ""):
                     self.app.status = PkgStates.NORUN
                     # self.ui.btn.setText("已安装")
                     self.ui.btn.setText(_("Aldy install"))
                     self.ui.btn.setEnabled(False)
                     self.ui.btn.setStyleSheet(
                         "QPushButton{font-size:12px;color:#000000;border:0px;background-color:#ffffff;}"
                     )
                     # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-un-border.png');}")
                 else:
                     self.app.status = PkgStates.RUN
                     #self.ui.btn.setText("启动")
                     self.ui.btn.setText(_("Start"))
                     self.ui.btn.setEnabled(True)
                     self.ui.btn.setStyleSheet(
                         "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                     )
コード例 #6
0
    def __init__(self, appname, app, backend, parent=None):
        QWidget.__init__(self,parent)
        self.ui_init()
        self.appname = appname
        self.app = app
        self.backend = backend
        self.parent = parent
        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btn.setStyleSheet(LIST_BUTTON_STYLE % (UBUNTUKYLIN_RES_PATH+"btn-small2-1.png",UBUNTUKYLIN_RES_PATH+"btn-small2-2.png",UBUNTUKYLIN_RES_PATH+"btn-small2-3.png"))

        self.ui.btn.setVisible(True)
        if self.app is None:
            if (self.appname == 'wine-qq' or self.appname == 'ppstream'):
                self.ui.btn.setText("安装")
            else:
                self.ui.btn.setText("无效")
        else:
            if(app.is_installed):
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setEnabled(False)
                else:
                    self.ui.btn.setText("启动")
            else:
                self.ui.btn.setText("安装")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.connect(self.parent,Signals.apt_process_finish,self.slot_work_finished)
        self.connect(self.parent,Signals.apt_process_cancel,self.slot_work_cancel)
コード例 #7
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         if action in (AppActions.INSTALL, AppActions.UPGRADE,
                       AppActions.INSTALLDEBFILE):
             self.ui.status.show()
             if (run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("卸载")
                 self.app.status = PkgStates.UNINSTALL
                 self.ui.btn.setEnabled(True)
                 self.workType = "un"
                 self.ui.cbSelect.setEnabled(False)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:14px;background:#b2bbc7;border:1px solid #97a5b9;color:white;}QPushButton:hover{background-color:#bac7d7;border:1px solid #97a5b9;color:white;}QPushButton:pressed{background-color:#97a5b9;border:1px solid #7e8da1;color:white;}"
                 )
             else:
                 self.ui.btn.setText("启动")
                 self.app.status = PkgStates.RUN
                 self.ui.btn.setEnabled(True)
                 self.workType = "run"
                 self.ui.cbSelect.setEnabled(False)
                 self.ui.btn.setStyleSheet(
                     "QPushButton{font-size:14px;background:#0FA2E8;border:1px solid #0F84BC;color:white;}QPushButton:hover{background-color:#14ACF5;border:1px solid #0F84BC;color:white;}QPushButton:pressed{background-color:#0B95D7;border:1px solid #0479B1;color:white;}"
                 )
         elif action == AppActions.REMOVE:
             self.ui.status.hide()
             self.ui.btn.setText("安装")
             self.app.status = PkgStates.INSTALL
             self.ui.btn.setEnabled(True)
             self.workType = "ins"
             self.ui.cbSelect.setEnabled(True)
             self.ui.btn.setStyleSheet(
                 "QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}"
             )
コード例 #8
0
    def __init__(self, appname, app, backend, parent=None):
        QWidget.__init__(self,parent)
        self.ui_init()
        self.appname = appname
        self.app = app
        self.backend = backend
        self.parent = parent
        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btn.setStyleSheet(LIST_BUTTON_STYLE % (UBUNTUKYLIN_RES_PATH+"btn-small2-1.png",UBUNTUKYLIN_RES_PATH+"btn-small2-2.png",UBUNTUKYLIN_RES_PATH+"btn-small2-3.png"))

        self.ui.btn.setVisible(True)
        if self.app is None:
            if (self.appname == 'wine-qq' or self.appname == 'ppstream'):
                self.ui.btn.setText("安装")
            else:
                self.ui.btn.setText("无效")
        else:
            if(app.is_installed):
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setEnabled(False)
                else:
                    self.ui.btn.setText("启动")
            else:
                self.ui.btn.setText("安装")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.parent.apt_process_finish.connect(self.slot_work_finished)
        self.parent.apt_process_cancel.connect(self.slot_work_cancel)
コード例 #9
0
    def slot_work_finished(self, pkgname, action):
        if self.app.name == pkgname:
            if action in (AppActions.INSTALL, AppActions.UPGRADE,
                          AppActions.INSTALLDEBFILE):
                self.ui.status.show()
                if (run.get_run_command(self.app.name) == ""):
                    #self.ui.btn.setText("卸载")
                    self.ui.btn.setText(_("Uninstall"))
                    self.ui.baseWidget.setStyleSheet(
                        ".QWidget{border:1px solid #e5e5e5;background-color:#ffffff;}.QWidget:hover{border:1px solid #2d8ae1}"
                    )
                    self.ui.progressBar.hide()
                    self.ui.progresslabel.hide()
                    #self.ui.progressBarsmall.hide()
                    self.ui.btn.show()
                    self.app.status = PkgStates.UNINSTALL
                    self.ui.btn.setEnabled(True)
                    self.workType = "un"
                    self.ui.cbSelect.setEnabled(False)
                    self.ui.btn.setStyleSheet(
                        "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}"
                    )
                else:
                    #self.ui.btn.setText("启动")
                    self.ui.btn.setText(_("Start"))
                    self.ui.baseWidget.setStyleSheet(
                        ".QWidget{border:1px solid #e5e5e5;background-color:#ffffff;}.QWidget:hover{border:1px solid #2d8ae1}"
                    )
                    self.ui.progressBar.hide()
                    self.ui.progresslabel.hide()
                    #self.ui.progressBarsmall.hide()
                    self.ui.btn.show()

                    self.app.status = PkgStates.RUN
                    self.ui.btn.setEnabled(True)
                    self.workType = "run"
                    self.ui.cbSelect.setEnabled(False)
                    self.ui.btn.setStyleSheet(
                        "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                    )
            elif action == AppActions.REMOVE:
                self.ui.status.hide()
                #self.ui.btn.setText("安装")
                self.ui.btn.setText(_("Install"))
                self.ui.baseWidget.setStyleSheet(
                    ".QWidget{border:1px solid #e5e5e5;background-color:#ffffff;}.QWidget:hover{border:1px solid #2d8ae1}"
                )
                self.ui.progressBar.hide()
                self.ui.progresslabel.hide()
                #self.ui.progressBarsmall.hide()
                self.ui.btn.show()

                self.app.status = PkgStates.INSTALL
                self.ui.btn.setEnabled(True)
                self.workType = "ins"
                self.ui.cbSelect.setEnabled(True)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                )
コード例 #10
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         self.ui.btn.setEnabled(True)
         if action in (AppActions.INSTALL,AppActions.INSTALLDEBFILE):
             if(run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("已安装")
                 self.ui.btn.setEnabled(False)
             else:
                 self.ui.btn.setText("启动")
         elif action == AppActions.REMOVE:
             self.ui.btn.setText("安装")
         elif action == AppActions.UPGRADE:
             if(run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("已安装")
                 self.ui.btn.setEnabled(False)
             else:
                 self.ui.btn.setText("启动")
コード例 #11
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         if action == AppActions.INSTALL:
             if(run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("已安装")
                 self.ui.btn.setEnabled(False)
             else:
                 self.ui.btn.setText("启动")
                 self.ui.btn.setEnabled(True)
         elif action == AppActions.REMOVE:
             self.ui.btn.setText("安装")
         elif action == AppActions.UPGRADE:
             if(run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("已安装")
                 self.ui.btn.setEnabled(False)
             else:
                 self.ui.btn.setText("启动")
コード例 #12
0
 def slot_work_finished(self, pkgname, action):
     if self.app.name == pkgname:
         if(run.get_run_command(self.app.name) == ""):
             self.ui.btn.setText("已安装")
             self.ui.btn.setEnabled(False)
         else:
             self.ui.btn.setText("启动")
             self.ui.btn.setEnabled(True)
コード例 #13
0
    def __init__(self,app, mainwin, parent=None):
        QWidget.__init__(self,parent)
        self.ui_init()
        self.app = app
        self.mainwin = mainwin
        self.parent = parent

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setText("详情")
        self.ui.btnDetail.hide()

        if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
            self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
            self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg"))
        else:
            self.ui.softIcon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + "default.png"))
        self.ui.softName.setStyleSheet("QLabel{font-family:'ubuntu';font-size:14px;font-weight:bold;}")
        self.ui.softDescr.setStyleSheet("QLabel{font-size:13px;color:#7E8B97;}")
        self.ui.btn.setStyleSheet(RECOMMEND_BUTTON_STYLE %(UBUNTUKYLIN_RES_PATH + "btn1-1.png",UBUNTUKYLIN_RES_PATH + "btn1-2.png",UBUNTUKYLIN_RES_PATH + "btn1-3.png"))
        self.ui.btnDetail.setStyleSheet(RECOMMEND_BUTTON_STYLE %(UBUNTUKYLIN_RES_PATH + "btn6-1.png",UBUNTUKYLIN_RES_PATH + "btn6-2.png",UBUNTUKYLIN_RES_PATH + "btn6-3.png"))

        # letter spacing
        font = QFont()
        font.setLetterSpacing(QFont.PercentageSpacing, 90.0)
        self.ui.softName.setFont(font)
        self.ui.softDescr.setFont(font)
        if(len(self.app.name) > 18):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.softName.setFont(font2)
            self.ui.softName.setStyleSheet("QLabel{font-size:13px;font-weight:bold;}")
        if(len(self.app.name) > 21):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.softName.setFont(font2)
            self.ui.softName.setStyleSheet("QLabel{font-size:12px;font-weight:bold;}")

        self.ui.softName.setText(self.app.name)
        self.ui.softDescr.setText(self.app.displayname)

        if(self.app.is_installed):
            if(run.get_run_command(self.app.name) == ""):
                self.ui.btn.setText("已安装")
                self.ui.btn.setEnabled(False)
            else:
                self.ui.btn.setText("启动")
        else:
            self.ui.btn.setText("安装")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
        self.connect(self.mainwin,Signals.apt_process_finish,self.slot_work_finished)
        self.connect(self.mainwin,Signals.apt_process_cancel,self.slot_work_cancel)
コード例 #14
0
 def slot_work_cancel(self, pkgname, action):
     if self.app.name == pkgname:
         self.ui.btn.setEnabled(True)
         if action == AppActions.INSTALL:
             self.ui.btn.setText("安装")
         elif action == AppActions.REMOVE:
             if(run.get_run_command(self.app.name) == ""):
                 self.ui.btn.setText("已安装")
                 self.ui.btn.setEnabled(False)
             else:
                 self.ui.btn.setText("启动")
コード例 #15
0
    def __init__(self, app, messageBox, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()
        self.app = app
        self.messageBox = messageBox
        self.parent = parent

        self.ui.bg.lower()

        self.ui.cbSelect.raise_()
        self.ui.btn.raise_()
        self.ui.btnDetail.stackUnder(self.ui.cbSelect)

        self.ui.installedsize.setAlignment(Qt.AlignCenter)
        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.cbSelect.setFocusPolicy(Qt.NoFocus)

        iconpath = commontools.get_icon_path(self.app.name)
        self.ui.icon.setStyleSheet("QLabel{background-image:url('" + iconpath +
                                   "');background-color:transparent;}")

        self.ui.status.setStyleSheet(
            "QLabel{background-image:url('res/installed.png')}")
        self.ui.name.setStyleSheet("QLabel{font-size:14px;font-weight:bold;}")
        self.ui.installedsize.setStyleSheet("QLabel{font-size:14px;}")
        self.ui.summary.setStyleSheet("QLabel{font-size:13px;color:#7E8B97;}")
        self.ui.bg.setStyleSheet(
            "QWidget#bg{background-color:#F3F2F5;border:1px solid #F8F7FA;}")
        self.ui.btnDetail.setStyleSheet(
            "QPushButton#btnDetail{border:0px;}QPushButton#btnDetail:hover{background-image:url('res/listwidgethover.png');}"
        )
        self.ui.cbSelect.setStyleSheet(
            "QCheckBox{font-size:13px;}QCheckBox:hover{background-color:#F3F2F5;}"
        )
        if self.app.displayname_cn != '' and self.app.displayname_cn is not None and self.app.displayname_cn != 'None':
            self.ui.name.setText(app.displayname_cn)
        else:
            self.ui.name.setText(app.displayname)
        if self.app.summary is not None and self.app.summary != 'None' and self.app.summary != '':
            self.ui.summary.setText(self.app.summary)
        else:
            self.ui.summary.setText(self.app.orig_summary)

        # installedsize = app.installedSize
        installedsize = app.packageSize
        installedsizek = installedsize / 1024
        if (installedsizek == 0):
            self.ui.installedsize.setText("未知")
        elif (installedsizek < 1024):
            self.ui.installedsize.setText(str('%.1f' % installedsizek) + " KB")
        else:
            self.ui.installedsize.setText(
                str('%.2f' % (installedsizek / 1024.0)) + " MB")

        installDate = app.install_date[:app.install_date.find('T')]
        self.ui.installedDate.setText(installDate + " 安装")
        if (self.app.status in (PkgStates.INSTALLING, PkgStates.REMOVING,
                                PkgStates.UPGRADING
                                )):  #zx11.28 keep btn status same in all page
            self.ui.status.hide()
            if self.app.status == PkgStates.INSTALLING:
                if self.app.percent > 0:
                    self.ui.btn.setText("正在安装")
                else:
                    self.ui.btn.setText("等待安装")
                self.ui.btn.setEnabled(False)
                self.ui.cbSelect.setEnabled(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}"
                )

            elif self.app.status == PkgStates.REMOVING:
                self.ui.btn.setEnabled(False)
                if self.app.percent > 0:
                    self.ui.btn.setText("正在卸载")
                else:
                    self.ui.btn.setText("等待卸载")
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:14px;background:#b2bbc7;border:1px solid #97a5b9;color:white;}QPushButton:hover{background-color:#bac7d7;border:1px solid #97a5b9;color:white;}QPushButton:pressed{background-color:#97a5b9;border:1px solid #7e8da1;color:white;}"
                )

            elif self.app.status == PkgStates.UPGRADING:
                self.ui.btn.setEnabled(False)
                if self.app.percent > 0:
                    self.ui.btn.setText("正在升级")
                else:
                    self.ui.btn.setText("等待升级")
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:14px;background:#edac3a;border:1px solid #df9b23;color:white;}QPushButton:hover{background-color:#fdbf52;border:1px solid #df9b23;color:white;}QPushButton:pressed{background-color:#e29f29;border:1px solid #c07b04;color:white;}"
                )

        else:
            if (app.is_installed):
                self.ui.status.show()
                if (app.is_upgradable):
                    self.ui.btn.setText("升级")
                    self.ui.btn.setEnabled(True)
                    self.app.status = PkgStates.UPDATE
                    self.workType = "up"
                    self.ui.cbSelect.setEnabled(False)
                    self.ui.btn.setStyleSheet(
                        "QPushButton{font-size:14px;background:#edac3a;border:1px solid #df9b23;color:white;}QPushButton:hover{background-color:#fdbf52;border:1px solid #df9b23;color:white;}QPushButton:pressed{background-color:#e29f29;border:1px solid #c07b04;color:white;}"
                    )
                else:
                    if (run.get_run_command(self.app.name) != ""):
                        self.ui.btn.setText("启动")
                        self.ui.btn.setEnabled(True)
                        self.app.status = PkgStates.RUN
                        self.workType = "run"
                        self.ui.cbSelect.setEnabled(False)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:14px;background:#0FA2E8;border:1px solid #0F84BC;color:white;}QPushButton:hover{background-color:#14ACF5;border:1px solid #0F84BC;color:white;}QPushButton:pressed{background-color:#0B95D7;border:1px solid #0479B1;color:white;}"
                        )
                    else:
                        self.ui.btn.setText("卸载")
                        self.ui.btn.setEnabled(True)
                        self.app.status = PkgStates.UNINSTALL
                        self.workType = "un"
                        self.ui.cbSelect.setEnabled(False)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:14px;background:#b2bbc7;border:1px solid #97a5b9;color:white;}QPushButton:hover{background-color:#bac7d7;border:1px solid #97a5b9;color:white;}QPushButton:pressed{background-color:#97a5b9;border:1px solid #7e8da1;color:white;}"
                        )
            else:
                self.ui.status.hide()
                self.ui.btn.setText("安装")
                self.ui.btn.setEnabled(True)
                self.app.status = PkgStates.INSTALL
                self.workType = "ins"
                self.ui.cbSelect.setEnabled(True)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:14px;background:#0bc406;border:1px solid #03a603;color:white;}QPushButton:hover{background-color:#16d911;border:1px solid #03a603;color:white;}QPushButton:pressed{background-color:#07b302;border:1px solid #037800;color:white;}"
                )

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #16
0
    def __init__(self, app, messageBox, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()
        self.app = app
        self.messageBox = messageBox
        self.parent = parent

        # self.ui.bg.lower()

        # self.ui.baseWidget.setAutoFillBackground(True)
        self.ui.cbSelect.raise_()
        self.ui.btn.raise_()

        self.ui.progressBar.lower()

        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.installedsize.setAlignment(Qt.AlignCenter)
        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.cbSelect.setFocusPolicy(Qt.NoFocus)

        iconpath = commontools.get_icon_path(self.app.name)
        self.ui.icon.setStyleSheet(
            "QLabel{background-color: transparent;background-image:url('" +
            iconpath + "');background-color:transparent;}")

        self.ui.baseWidget.setStyleSheet(
            ".QWidget{border:1px solid #e5e5e5;background-color:transparent;}.QWidget:hover{border:1px solid #2d8ae1}"
        )
        self.ui.status.setStyleSheet(
            "QLabel{background-image:url('res/installed.png')}")
        self.ui.name.setStyleSheet(
            "QLabel{background-color: transparent;font-size:14px;color:#000000;}"
        )
        self.ui.installedsize.setStyleSheet(
            "QLabel{background-color: transparent;font-size:12px;color:#888888;}"
        )
        self.ui.summary.setStyleSheet(
            "QLabel{background-color: transparent;font-size:12px;color:#888888;}"
        )
        # self.ui.bg.setStyleSheet("QWidget#bg{background-color:#F3F2F5;border:1px solid #F8F7FA;}")
        self.ui.btnDetail.setStyleSheet(
            "QPushButton{border:0px;background-color:transparent;}")
        # self.ui.cbSelect.setStyleSheet("QCheckBox{outline: none;border:1px solid #d5d5d5;}QCheckBox:hover{border:1px solid #2d8ae1;}")
        self.ui.installedDate.setStyleSheet(
            "QLabel{background-color: transparent;font-size:12px;color:#888888;}"
        )
        if (Globals.MIPS64):
            self.ui.progressBar.setStyleSheet(
                "QProgressBar{background-color:#ffffff;border-radius:0px;color:#1E66A4;}"
            )
        else:
            self.ui.progressBar.setStyleSheet(
                "QProgressBar{background-color:#ffffff;border-radius:0px;color:#1E66A4;}"
                "QProgressBar:chunk{background-color:#5DC4FE;}")
        self.ui.progresslabel.setStyleSheet(
            "QLabel{font-size:12px;color:#2d8ae1;background-color:transparent;}"
        )

        if self.app.displayname_cn != '' and self.app.displayname_cn is not None and self.app.displayname_cn != 'None':
            self.ui.name.setText(app.displayname_cn)
        else:
            self.ui.name.setText(app.displayname)
        if self.app.summary is not None and self.app.summary != 'None' and self.app.summary != '':
            self.ui.summary.setText(self.app.summary)
        else:
            self.ui.summary.setText(self.app.orig_summary)

        # installedsize = app.installedSize
        installedsize = app.installedSize
        installedsizek = installedsize / 1024

        if (installedsizek == 0):
            #self.ui.installedsize.setText("未知")
            self.ui.installedsize.setText(_("unknown"))

        elif (installedsizek < 1024):
            self.ui.installedsize.setText(str('%.1f' % installedsizek) + " KB")
        else:
            self.ui.installedsize.setText(
                str('%.2f' % (installedsizek / 1024.0)) + " MB")

        installDate = app.install_date[:app.install_date.find('T')]
        #self.ui.installedDate.setText(installDate + " 安装")
        self.ui.installedDate.setText(installDate + _("Install"))
        if (self.app.status in (PkgStates.INSTALLING, PkgStates.REMOVING,
                                PkgStates.UPGRADING
                                )):  #zx11.28 keep btn status same in all page
            self.ui.status.hide()
            if self.app.status == PkgStates.INSTALLING:
                if self.app.percent > 0:
                    #self.ui.btn.setText("正在安装")
                    self.ui.btn.setText(_("Installing"))
                else:
                    #self.ui.btn.setText("等待安装")
                    self.ui.btn.setText(_("Waiting for installation"))
                self.ui.btn.setEnabled(False)
                self.ui.cbSelect.setEnabled(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                )

            elif self.app.status == PkgStates.REMOVING:
                self.ui.btn.setEnabled(False)
                if self.app.percent > 0:
                    #self.ui.btn.setText("正在卸载")
                    self.ui.btn.setText(_("Uninstalling"))
                else:
                    #self.ui.btn.setText("等待卸载")
                    self.ui.btn.setText(_("Waiting for uninstall"))
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}"
                )

            elif self.app.status == PkgStates.UPGRADING:
                self.ui.btn.setEnabled(False)
                if self.app.percent > 0:
                    #self.ui.btn.setText("正在升级")
                    self.ui.btn.setText(_("upgrading"))
                else:
                    #self.ui.btn.setText("等待升级")
                    self.ui.btn.setText(_("Waiting for upgrade"))
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}"
                )

        else:
            if (app.is_installed):
                self.ui.status.show()
                if (app.is_upgradable):
                    # self.ui.btn.setText("升级")
                    self.ui.btn.setText(_("Upgrade"))
                    self.ui.btn.setEnabled(True)
                    self.app.status = PkgStates.UPDATE
                    self.workType = "up"
                    self.ui.cbSelect.setEnabled(False)
                    self.ui.btn.setStyleSheet(
                        "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}"
                    )
                else:
                    if (run.get_run_command(self.app.name) != ""):
                        #self.ui.btn.setText("启动")
                        self.ui.btn.setText(_("Start"))
                        self.ui.btn.setEnabled(True)
                        self.app.status = PkgStates.RUN
                        self.workType = "run"
                        self.ui.cbSelect.setEnabled(False)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                        )
                    else:
                        #self.ui.btn.setText("卸载")
                        self.ui.btn.setText(_("Uninstall"))
                        self.ui.btn.setEnabled(True)
                        self.app.status = PkgStates.UNINSTALL
                        self.workType = "un"
                        self.ui.cbSelect.setEnabled(False)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}"
                        )
            else:
                self.ui.status.hide()
                #self.ui.btn.setText("安装")
                self.ui.btn.setText(_("Install"))
                self.ui.btn.setEnabled(True)
                self.app.status = PkgStates.INSTALL
                self.workType = "ins"
                self.ui.cbSelect.setEnabled(True)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                )

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #17
0
    def __init__(self, winstat, app, parent=None):
        QWidget.__init__(self,parent)
        self.ui_init()
        self.winstat = winstat
        self.app = app

        self.switchTimer = QTimer(self)
        self.switchTimer.timeout.connect(self.slot_switch_animation_step)

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)

        self.ui.btnDetail.setCursor(Qt.PointingHandCursor)

        self.ui.description.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        # self.ui.baseWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.baseWidget.setPalette(palette)

        self.ui.baseWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/wincard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.baseWidget.setPalette(palette)

        # self.ui.detailWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.detailWidget.setPalette(palette)

        self.ui.detailWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/wincard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.detailWidget.setPalette(palette)

        palette = QPalette()
        palette.setBrush(QPalette.Base, QBrush(QColor(255,0,0,0)))
        self.ui.description.setPalette(palette)

        img = QPixmap("res/arrowhead.png")
        self.ui.arronicon.setPixmap(img)

        # win frame
        if(os.path.isfile(UBUNTUKYLIN_RES_WIN_PATH + str(self.winstat.windows_app_name) + ".png")):
            self.ui.winicon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_WIN_PATH + str(self.winstat.windows_app_name) + ".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_WIN_PATH + str(self.winstat.windows_app_name) + ".jpg")):
            self.ui.winicon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_WIN_PATH + str(self.winstat.windows_app_name) + ".jpg"))
        else:
            self.ui.winicon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_WIN_PATH + "default.png"))
        self.ui.winname.setText(self.winstat.windows_app_name)
        self.ui.wintext.setText(self.winstat.display_name_windows)
        self.ui.winbake.setText(self.winstat.category)

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq' or self.winstat.app_name == 'ppstream'):
                if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.winstat.app_name) + ".png")):
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.winstat.app_name) + ".png"))
                elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.winstat.app_name) + ".jpg")):
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.winstat.app_name) + ".jpg"))
                elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + str(self.winstat.app_name) + ".png")):
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + str(self.winstat.app_name) + ".png"))
                elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + str(self.winstat.app_name) + ".jpg")):
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + str(self.winstat.app_name) + ".jpg"))
                else:
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + "default.png"))
        else:
            if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
                self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png"))
            elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
                self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg"))
            elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + str(self.app.name) + ".png")):
                    self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + str(self.app.name) + ".png"))
            elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + str(self.app.name) + ".jpg")):
                self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + str(self.app.name) + ".jpg"))
            else:
                self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + "default.png"))

        # self.ui.baseWidget.setStyleSheet("QWidget{border:0px;}")
        self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.named.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.size.setStyleSheet("QLabel{font-size:13px;color:#888888;}")
        self.ui.description.setStyleSheet("QTextEdit{border:0px;font-size:13px;color:#888888;}")

        # letter spacing
        font = QFont()
        font.setLetterSpacing(QFont.PercentageSpacing, 90.0)
        self.ui.name.setFont(font)
        self.ui.description.setFont(font)
        if self.app is None:
            if (self.winstat.app_name == 'wine-qq' or self.winstat.app_name == 'ppstream'):
                if(len(self.winstat.app_name) > 20):
                    font2 = QFont()
                    font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
                    self.ui.name.setFont(font2)
                    self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;}")
                if(len(self.winstat.app_name) > 24):
                    font2 = QFont()
                    font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
                    self.ui.name.setFont(font2)
                    self.ui.name.setStyleSheet("QLabel{font-size:12px;font-weight:bold;}")
        else:
            if(len(self.app.displayname) > 20):
                font2 = QFont()
                font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
                self.ui.name.setFont(font2)
                self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;}")
            if(len(self.app.displayname) > 24):
                font2 = QFont()
                font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
                self.ui.name.setFont(font2)
                self.ui.name.setStyleSheet("QLabel{font-size:12px;font-weight:bold;}")

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq' or self.winstat.app_name == 'ppstream'):
                self.ui.size.setText("")
                self.ui.name.setText(self.winstat.app_name)
                self.ui.named.setText(self.winstat.app_name)
                self.ui.description.setText(self.winstat.app_name)
        else:
            # convert size
            installedsize = self.app.installedSize
            installedsizek = installedsize / 1024
            if(installedsizek < 1024):
                self.ui.size.setText(str(installedsizek) + " KB")
            else:
                self.ui.size.setText(str('%.2f'%(installedsizek/1024.0)) + " MB")
            self.ui.name.setText(self.app.displayname)
            self.ui.named.setText(self.app.displayname)
            self.ui.description.setText(self.app.description)

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq' or self.winstat.app_name == 'ppstream'):
                self.ui.btn.setText("安装")
                self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/wincard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/wincard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/wincard-install-btn-3.png');}")
                self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")
            else:
                self.ui.btn.setText("无效")
        else:
            if(self.app.is_installed):
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/wincard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/wincard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/wincard-un-btn-3.png');}")
                    self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-un-border.png');}")
                    self.ui.btn.setEnabled(False)
                else:
                    self.ui.btn.setText("启动")
                    self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/wincard-run-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/wincard-run-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/wincard-run-btn-3.png');}")
                    self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-run-border.png');}")
            else:
                self.ui.btn.setText("安装")
                self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/wincard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/wincard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/wincard-install-btn-3.png');}")
                self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #18
0
    def __init__(self, app, nowpage, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()

        self.app = app
        self.workType = nowpage

        self.switchTimer = QTimer(self)
        self.switchTimer.timeout.connect(self.slot_switch_animation_step)

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)

        self.ui.btnDetail.setCursor(Qt.PointingHandCursor)

        self.ui.description.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        # self.ui.baseWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.baseWidget.setPalette(palette)

        self.ui.baseWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/ncard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.baseWidget.setPalette(palette)

        # self.ui.detailWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.detailWidget.setPalette(palette)

        self.ui.detailWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/ncard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.detailWidget.setPalette(palette)

        palette = QPalette()
        palette.setBrush(QPalette.Base, QBrush(QColor(255,0,0,0)))
        self.ui.description.setPalette(palette)

        # component shadow
        # shadowe = QGraphicsDropShadowEffect(self)
        # shadowe.setOffset(-2, 2)    # direction
        # shadowe.setColor(Qt.gray)
        # shadowe.setBlurRadius(4)
        # self.setGraphicsEffect(shadowe)

        if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".jpg"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg"))
        else:
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + "default.png"))

        # self.ui.baseWidget.setStyleSheet("QWidget{border:0px;}")
        self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.named.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.size.setStyleSheet("QLabel{font-size:13px;color:#888888;}")
        self.ui.description.setStyleSheet("QTextEdit{border:0px;font-size:13px;color:#888888;}")

        # letter spacing
        font = QFont()
        font.setLetterSpacing(QFont.PercentageSpacing, 90.0)
        self.ui.name.setFont(font)
        self.ui.description.setFont(font)
        if(len(self.app.displayname) > 20):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.name.setFont(font2)
            self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;}")
        if(len(self.app.displayname) > 24):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.name.setFont(font2)
            self.ui.name.setStyleSheet("QLabel{font-size:12px;font-weight:bold;}")

        # convert size
        installedsize = self.app.installedSize
        installedsizek = installedsize / 1024
        if(installedsizek < 1024):
            self.ui.size.setText(str(installedsizek) + " KB")
        else:
            self.ui.size.setText(str('%.2f'%(installedsizek/1024.0)) + " MB")

        self.ui.name.setText(self.app.displayname)
        self.ui.named.setText(self.app.displayname)
        self.ui.description.setText(self.app.summary)

        # rating star
        star = StarWidget("small", self.app.ratings_average, self.ui.baseWidget)
        star.move(75, 56)

        # btn & border
        if(nowpage == 'allpage'):
            if(app.is_installed):
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setEnabled(False)
                    self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}")
                    self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                else:
                    self.ui.btn.setText("启动")
                    self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-run-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-run-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-run-btn-3.png');}")
                    self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}")
            else:
                self.ui.btn.setText("安装")
                self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-install-btn-3.png');}")
                self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")
        elif(nowpage == 'uppage'):
            self.ui.btn.setText("升级")
            self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-up-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-up-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-up-btn-3.png');}")
            self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-up-border.png');}")
        elif(nowpage == 'unpage'):
            self.ui.btn.setText("卸载")
            self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}")
            self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
        elif(nowpage == 'searchpage'):
            self.ui.btn.setText("查看详情")
            self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-install-btn-3.png');}")
            self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #19
0
    def __init__(self, app, messageBox, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()

        self.app = app
        self.messageBox = messageBox

        self.switchTimer = QTimer(self)
        self.switchTimer.timeout.connect(self.slot_switch_animation_step)

        # add by kobe: delay show animation
        self.showDelay = False
        self.delayTimer = QTimer(self)
        self.delayTimer.timeout.connect(self.slot_show_delay_animation)

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)

        self.ui.btnDetail.setCursor(Qt.PointingHandCursor)

        self.ui.description.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.ui.description.setReadOnly(True)

        self.ui.baseWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/ncard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.baseWidget.setPalette(palette)

        self.ui.detailWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/ncard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        self.ui.detailWidget.setPalette(palette)

        palette = QPalette()
        palette.setBrush(QPalette.Base, QBrush(QColor(255, 0, 0, 0)))
        self.ui.description.setPalette(palette)

        iconpath = commontools.get_icon_path(self.app.name)
        self.ui.icon.setStyleSheet("QLabel{background-image:url('" + iconpath +
                                   "');background-color:transparent;}")

        # self.ui.baseWidget.setStyleSheet("QWidget{border:0px;}")
        self.ui.name.setStyleSheet(
            "QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.named.setStyleSheet(
            "QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.size.setStyleSheet("QLabel{font-size:13px;color:#888888;}")
        self.ui.description.setStyleSheet(
            "QTextEdit{border:0px;font-size:13px;color:#888888;}")

        # letter spacing
        font = QFont()
        font.setLetterSpacing(QFont.PercentageSpacing, 90.0)
        self.ui.name.setFont(font)
        self.ui.description.setFont(font)
        if (len(self.app.displayname) > 20):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.name.setFont(font2)
            self.ui.name.setStyleSheet(
                "QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        if (len(self.app.displayname) > 24):
            font2 = QFont()
            font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
            self.ui.name.setFont(font2)
            self.ui.name.setStyleSheet(
                "QLabel{font-size:12px;font-weight:bold;color:#666666;}")

        # convert size
        # installedsize = self.app.installedSize
        installedsize = self.app.packageSize
        installedsizek = installedsize / 1024
        if (installedsizek == 0):
            self.ui.size.setText("未知")
        elif (installedsizek < 1024):
            self.ui.size.setText(str('%.1f' % installedsizek) + " KB")
        else:
            self.ui.size.setText(
                str('%.2f' % (installedsizek / 1024.0)) + " MB")

        # self.ui.name.setText(self.app.displayname)
        # self.ui.named.setText(self.app.displayname)
        # add by kobe
        if self.app.displayname_cn != '' and self.app.displayname_cn is not None and self.app.displayname_cn != 'None':
            setLongTextToElideFormat(self.ui.name, self.app.displayname_cn)
            setLongTextToElideFormat(self.ui.named, self.app.displayname_cn)
        else:
            setLongTextToElideFormat(self.ui.name, self.app.displayname)
            setLongTextToElideFormat(self.ui.named, self.app.displayname)

        if self.app.summary is not None and self.app.summary != 'None' and self.app.summary != '':
            self.ui.description.setText(self.app.summary)
        else:
            self.ui.description.setText(self.app.orig_summary)

        # rating star
        star = StarWidget("small", self.app.ratings_average,
                          self.ui.baseWidget)
        star.move(75, 56)

        # btn & border
        if (app.is_installed):
            if (run.get_run_command(self.app.name) == ""):
                self.app.status = PkgStates.NORUN
                self.ui.btn.setText("已安装")
                self.ui.btn.setEnabled(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}"
                )
                self.ui.btnDetail.setStyleSheet(
                    "QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}"
                )
            else:
                self.app.status = PkgStates.RUN
                self.ui.btn.setText("启动")
                self.ui.btn.setEnabled(True)
                self.ui.btn.setStyleSheet(
                    "QPushButton{color:white;border:0px;background-image:url('res/ncard-run-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-run-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-run-btn-3.png');}"
                )
                self.ui.btnDetail.setStyleSheet(
                    "QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}"
                )
        else:
            self.app.status = PkgStates.INSTALL
            self.ui.btn.setText("安装")
            self.ui.btn.setEnabled(True)
            self.ui.btn.setStyleSheet(
                "QPushButton{color:white;border:0px;background-image:url('res/ncard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-install-btn-3.png');}"
            )
            self.ui.btnDetail.setStyleSheet(
                "QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}"
            )

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #20
0
    def __init__(self, app, messageBox, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()
        self.app = app
        self.messageBox = messageBox

        self.switchTimer = QTimer(self)
        # self.switchTimer.timeout.connect(self.slot_switch_animation_step)

        # add by kobe: delay show animation
        self.showDelay = False
        # self.delayTimer = QTimer(self)
        # self.delayTimer.timeout.connect(self.slot_show_delay_animation)

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-color:transparent;}")

        # self.ui.btnDetail.setCursor(Qt.PointingHandCursor)

        # self.ui.description.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # self.ui.description.setReadOnly(True)

        # self.ui.baseWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.baseWidget.setPalette(palette)

        self.ui.baseWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # img = QPixmap("res/ncard-base.png")
        # palette.setBrush(QPalette.Window, QBrush(img))
        # self.ui.baseWidget.setPalette(palette)

        # self.ui.detailWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.detailWidget.setPalette(palette)

        # self.ui.detailWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # img = QPixmap("res/ncard-base.png")
        # palette.setBrush(QPalette.Window, QBrush(img))
        # self.ui.detailWidget.setPalette(palette)

        # palette = QPalette()
        # palette.setBrush(QPalette.Base, QBrush(QColor(255,0,0,0)))
        # self.ui.description.setPalette(palette)

        # component shadow
        # shadowe = QGraphicsDropShadowEffect(self)
        # shadowe.setOffset(-2, 2)    # direction
        # shadowe.setColor(Qt.gray)
        # shadowe.setBlurRadius(4)
        # self.setGraphicsEffect(shadowe)

        iconpath = commontools.get_icon_path(self.app.name)
        self.ui.icon.setStyleSheet("QLabel{background-image:url('" + iconpath + "');background-color:transparent;}")
        self.ui.progressBar_icon.setStyleSheet("QLabel{background-color:transparent;background-image:url('" + iconpath + "')}")
        self.ui.baseWidget.setStyleSheet(".QWidget{border:1px solid #e5e5e5;background-color:#ffffff;}.QWidget:hover{border:1px solid #2d8ae1}")

        # self.ui.baseWidget.setStyleSheet("QWidget{border:0px;}")
        self.ui.name.setStyleSheet("QLabel{font-size:14px;color:#000000;background-color:transparent;}")
        # self.ui.progressBarname.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;background:transparent;}")
        # self.ui.named.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.size.setStyleSheet("QLabel{font-size:13px;color:#888888;background-color:transparent;}")
        self.ui.progresslabel.setStyleSheet("QLabel{font-size:13px;color:#888888;background-color:transparent;}")
        # self.ui.isInstalled.setStyleSheet("QLabel{font-size:13px;color:#888888;}")
        # self.ui.description.setStyleSheet("QTextEdit{border:0px;font-size:13px;color:#888888;}")

        # letter spacing
        # font = QFont()
        # font.setLetterSpacing(QFont.PercentageSpacing, 90.0)
        # self.ui.name.setFont(font)
        # self.ui.description.setFont(font)
        # if(len(self.app.displayname) > 20):
        #     font2 = QFont()
        #     font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
        #     self.ui.name.setFont(font2)
        #     self.ui.name.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        # if(len(self.app.displayname) > 24):
        #     font2 = QFont()
        #     font2.setLetterSpacing(QFont.PercentageSpacing, 80.0)
        #     self.ui.name.setFont(font2)
        #     self.ui.name.setStyleSheet("QLabel{font-size:12px;font-weight:bold;color:#666666;}")

        # convert size
        # installedsize = self.app.installedSize
        installedsize = self.app.packageSize
        installedsizek = installedsize / 1024
        if(installedsizek == 0):
            self.ui.size.setText("未知")
        elif(installedsizek < 1024):
            self.ui.size.setText(str('%.1f'%installedsizek) + " KB")
        else:
            self.ui.size.setText(str('%.2f'%(installedsizek/1024.0)) + " MB")

        # self.ui.name.setText(self.app.displayname)
        # self.ui.named.setText(self.app.displayname)
        # add by kobe
        if self.app.displayname_cn != '' and self.app.displayname_cn is not None and self.app.displayname_cn != 'None':
            setLongTextToElideFormat(self.ui.name, self.app.displayname_cn)
            # setLongTextToElideFormat(self.ui.progressBarname, self.app.displayname_cn)
            # setLongTextToElideFormat(self.ui.named, self.app.displayname_cn)
        else:
            setLongTextToElideFormat(self.ui.name, self.app.displayname)
            # setLongTextToElideFormat(self.ui.progressBarname, self.app.displayname)
            # setLongTextToElideFormat(self.ui.named, self.app.displayname)
        # if self.app.summary is not None and self.app.summary != 'None' and self.app.summary != '':
            # self.ui.description.setText(self.app.summary)
        # else:
        #     self.ui.description.setText(self.app.orig_summary)

        # rating star
        # self.star = StarWidget("small", self.app.ratings_average, self.ui.baseWidget)
        # self.star.move(75, 56)

        # add by kobe
        # self.ui.isInstalled.setText("已安装")
        if self.app.status in (PkgStates.INSTALLING, PkgStates.REMOVING, PkgStates.UPGRADING):
            # self.star.hide()
            self.ui.progressBar.setVisible(True)
            self.ui.progresslabel.setVisible(True)
            self.ui.progressBar_icon.setVisible(True)
            self.ui.progressBar.setValue(self.app.percent)
            self.ui.progressBarsmall.setValue(self.app.percent)
            self.ui.progresslabel.setText(str('%.0f' % self.app.percent) + '%')

        if self.app.status == PkgStates.INSTALLING:
            self.ui.btn.setEnabled(False)
            # if self.app.percent > 0:
            #     self.ui.btn.setText("正在安装")
            # else:
            #     self.ui.btn.setText("等待安装")
            self.ui.progressBar.setQPushButtonStyleSheet("QProgressBar{background-color:#ffffff;border:0px;border-radius:0px;}"
                                             "QProgressBar:chunk{background-color:#d5e8f9;}")
            self.ui.progressBarsmall.setStyleSheet("QProgressBar{background-color:#e5e5e5;border:0px;border-radius:0px;}"
                                             "QProgressBar:chunk{background-color:#2d8ae1;}")
            self.ui.progresslabel.setStyleSheet("QLabel{font-size:12px;color:#2d8ae1;background-color:transparent;}")
            # self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-install-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-install-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-install-btn-3.png');}")
            # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")
        elif self.app.status == PkgStates.REMOVING:
            self.ui.btn.setEnabled(False)
            # if self.app.percent > 0:
            #     self.ui.btn.setText("正在卸载")
            # else:
            #     self.ui.btn.setText("等待卸载")
            self.ui.progressBar.setStyleSheet("QProgressBar{background-color:#ffffff;border:0px;border-radius:0px;}"
                                                  "QProgressBar:chunk{background-color:#ffe0d6;}")
            self.ui.progressBarsmall.setStyleSheet("QProgressBar{background-color:#e5e5e5;border:0px;border-radius:0px;}"
                                                  "QProgressBar:chunk{background-color:#e95421;}")
            self.ui.progresslabel.setStyleSheet("QLabel{font-size:12px;color:#e95421;background-color:transparent;}")
            # self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-un-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-un-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-un-btn-3.png');}")
            # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")

        elif self.app.status == PkgStates.UPGRADING:
            self.ui.btn.setEnabled(False)
            # if self.app.percent > 0:
            #     self.ui.btn.setText("正在升级")
            # else:
            #     self.ui.btn.setText("等待升级")
            self.ui.progressBar.setStyleSheet("QProgressBar{background-color:#ffffff;border:0px;border-radius:0px;}"
                                                  "QProgressBar:chunk{background-color:#d1f8d1;}")
            self.ui.progressBarsmall.setStyleSheet("QProgressBar{background-color:#e5e5e5;border:0px;border-radius:0px;}"
                                                  "QProgressBar:chunk{background-color:#07c30b;}")
            self.ui.progresslabel.setStyleSheet("QLabel{font-size:12px;color:#07c30b;background-color:transparent;}")
            # self.ui.btn.setStyleSheet("QPushButton{color:white;border:0px;background-image:url('res/ncard-up-btn-1.png');}QPushButton:hover{border:0px;background-image:url('res/ncard-up-btn-2.png');}QPushButton:pressed{border:0px;background-image:url('res/ncard-up-btn-3.png');}")
            # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-up-border.png');}")

        elif(self.app.is_installed):
            # add by kobe
            # self.star.hide()
            # self.ui.isInstalled.setVisible(True)

            if(run.get_run_command(self.app.name) == ""):
                self.app.status = PkgStates.NORUN
                self.ui.btn.setText("已安装")
                self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}")
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
                self.ui.btn.setEnabled(False)
            else:
                self.app.status = PkgStates.RUN
                self.ui.btn.setText("启动")
                self.ui.btn.setEnabled(True)
                self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-run-border.png');}")
        else:
            # star = StarWidget("small", self.app.ratings_average, self.ui.baseWidget)
            # star.move(75, 56)
            # init app.status
            self.app.status = PkgStates.INSTALL
            # self.star.show()
            # self.ui.isInstalled.setVisible(False)
            self.ui.btn.setText("安装")
            self.ui.btn.setEnabled(True)
            self.ui.btn.setStyleSheet("QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}")
            # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-install-border.png');}")

        if isinstance(self.app, ApkInfo):
            if not Globals.APK_EVNRUN:
                self.ui.btn.setText("启动安卓环境")
        self.connect = self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #21
0
    def __init__(self, winstat, app, messageBox, parent=None):
        QWidget.__init__(self, parent)
        self.ui_init()
        self.winstat = winstat
        self.app = app
        self.messageBox = messageBox

        self.switchTimer = QTimer(self)
        # self.switchTimer.timeout.connect(self.slot_switch_animation_step)

        # add by kobe: delay show animation
        self.showDelay = False
        self.delayTimer = QTimer(self)
        # self.delayTimer.timeout.connect(self.slot_show_delay_animation)

        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setStyleSheet(
            "QPushButton{border:0px;background-color:transparent;}")

        # self.ui.btnDetail.setCursor(Qt.PointingHandCursor)

        # self.ui.description.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # self.ui.description.setReadOnly(True)

        # self.ui.baseWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.baseWidget.setPalette(palette)

        self.ui.baseWidget.setAutoFillBackground(True)
        self.ui.baseWidget.setStyleSheet(
            ".QWidget{border:1px solid #e5e5e5;background-color:#ffffff;}.QWidget:hover{border:1px solid #2d8ae1}"
        )

        # self.ui.detailWidget.setAutoFillBackground(True)
        # palette = QPalette()
        # palette.setColor(QPalette.Background, QColor(245, 248, 250))
        # self.ui.detailWidget.setPalette(palette)

        # self.ui.detailWidget.setAutoFillBackground(True)
        palette = QPalette()
        img = QPixmap("res/wincard-base.png")
        palette.setBrush(QPalette.Window, QBrush(img))
        # self.ui.detailWidget.setPalette(palette)

        palette = QPalette()
        palette.setBrush(QPalette.Base, QBrush(QColor(255, 0, 0, 0)))
        # self.ui.description.setPalette(palette)

        img = QPixmap("res/arrowhead.png")
        self.ui.arronicon.setPixmap(img)
        self.ui.arronicon.setStyleSheet(
            "QLabel{background-color:transparent;}")
        self.ui.winname.setStyleSheet(
            "QLabel{font-size:13px;font-weight:bold;color:#666666;background-color:transparent;}"
        )
        # self.ui.wintext.setStyleSheet("QLabel{font-size:13px;color:#888888;}")
        self.ui.winbake.setStyleSheet(
            "QLabel{font-size:13px;color:#888888;background-color:transparent;}"
        )
        self.ui.name.setStyleSheet(
            "QLabel{font-size:13px;font-weight:bold;color:#666666;background-color:transparent;}"
        )
        # self.ui.named.setStyleSheet("QLabel{font-size:13px;font-weight:bold;color:#666666;}")
        self.ui.size.setStyleSheet(
            "QLabel{font-size:13px;color:#888888;background-color:transparent;}"
        )
        # self.ui.description.setStyleSheet("QTextEdit{border:0px;font-size:13px;color:#888888;}")

        # win frame
        if (os.path.isfile(UBUNTUKYLIN_HTTP_WIN_RES_PATH +
                           str(self.winstat.windows_app_name) + ".png")):
            self.ui.winicon.setStyleSheet(
                ITEM_LABEL_STYLE %
                (UBUNTUKYLIN_HTTP_WIN_RES_PATH +
                 str(self.winstat.windows_app_name) + ".png"))
        elif (os.path.isfile(UBUNTUKYLIN_HTTP_WIN_RES_PATH +
                             str(self.winstat.windows_app_name) + ".jpg")):
            self.ui.winicon.setStyleSheet(
                ITEM_LABEL_STYLE %
                (UBUNTUKYLIN_HTTP_WIN_RES_PATH +
                 str(self.winstat.windows_app_name) + ".jpg"))
        elif (os.path.isfile(UBUNTUKYLIN_RES_WIN_PATH +
                             str(self.winstat.windows_app_name) + ".png")):
            self.ui.winicon.setStyleSheet(
                ITEM_LABEL_STYLE %
                (UBUNTUKYLIN_RES_WIN_PATH +
                 str(self.winstat.windows_app_name) + ".png"))
        elif (os.path.isfile(UBUNTUKYLIN_RES_WIN_PATH +
                             str(self.winstat.windows_app_name) + ".jpg")):
            self.ui.winicon.setStyleSheet(
                ITEM_LABEL_STYLE %
                (UBUNTUKYLIN_RES_WIN_PATH +
                 str(self.winstat.windows_app_name) + ".jpg"))
        else:
            self.ui.winicon.setStyleSheet(
                ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_WIN_PATH + "default.png"))

        # add by kobe
        #setLongTextToElideFormat(self.ui.winname, self.winstat.windows_app_name)
        #setLongTextToElideFormat(self.ui.wintext, self.winstat.display_name_windows)
        setLongTextToElideFormat(self.ui.winname,
                                 self.winstat.display_name_windows)
        # setLongTextToElideFormat(self.ui.wintext, self.winstat.windows_app_name)
        setLongTextToElideFormat(self.ui.winbake, self.winstat.category)
        # metrics = QFontMetrics(self.ui.winname.font())
        # elidedText = metrics.elidedText(self.winstat.windows_app_name, Qt.ElideRight, self.ui.winname.width())
        # self.ui.winname.setText(elidedText)

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq'
                    or self.winstat.app_name == 'ppstream'):
                iconpath = commontools.get_icon_path(self.winstat.app_name)
                self.ui.icon.setStyleSheet("QLabel{background-image:url('" +
                                           iconpath +
                                           "');background-color:transparent;}")
        else:
            iconpath = commontools.get_icon_path(self.app.name)
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" +
                                       iconpath +
                                       "');background-color:transparent;}")

        # self.ui.baseWidget.setStyleSheet("QWidget{border:0px;}")
        # self.ui.homeline1.setStyleSheet("QLabel{background-color:#CCCCCC;}")

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq'
                    or self.winstat.app_name == 'ppstream'):
                self.ui.size.setText("")
                # self.ui.name.setText(self.winstat.app_name)
                # self.ui.named.setText(self.winstat.app_name)
                setLongTextToElideFormat(self.ui.name, self.winstat.app_name)
                # setLongTextToElideFormat(self.ui.named, self.winstat.app_name)
                # self.ui.description.setText(self.winstat.description)
        else:
            # convert size
            # installedsize = self.app.installedSize
            installedsize = self.app.installedSize
            if installedsize == 0:
                installedsize = app.packageSize
            installedsizek = installedsize / 1024
            if (installedsizek == 0):
                #self.ui.size.setText("未知")
                self.ui.size.setText(_("unknown"))
            elif (installedsizek < 1024):
                self.ui.size.setText(str('%.1f' % installedsizek) + " KB")
            else:
                self.ui.size.setText(
                    str('%.2f' % (installedsizek / 1024.0)) + " MB")

            # add by kobe
            if self.app.displayname_cn != '' and self.app.displayname_cn is not None and self.app.displayname_cn != 'None':
                setLongTextToElideFormat(self.ui.name, self.app.displayname_cn)
                # setLongTextToElideFormat(self.ui.named, self.app.displayname_cn)
            else:
                setLongTextToElideFormat(self.ui.name, self.app.displayname)
                # setLongTextToElideFormat(self.ui.named, self.app.displayname)
            # if self.app.summary is not None and self.app.summary != 'None' and self.app.summary != '':
            # self.ui.description.setText(self.app.summary)
            # else:
            #     self.ui.description.setText(self.app.orig_summary)

        if self.app is None:
            if (self.winstat.app_name == 'wine-qq'
                    or self.winstat.app_name == 'ppstream'):
                #self.ui.btn.setText("安装")
                self.ui.btn.setText(_("Install"))
                self.ui.btn.setEnabled(True)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                )
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")
            else:
                #self.ui.btn.setText("无效")
                self.ui.btn.setText(_("invalid"))
                self.ui.btn.setEnabled(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:0px;background-color:#ffffff;}"
                )
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/ncard-un-border.png');}")
        else:
            if app.status == PkgStates.INSTALLING:
                self.ui.btn.setEnabled(False)
                # self.ui.btn.setText("正在安装")
                self.ui.btn.setText(_("Installing"))
                # self.ui.isInstalled.setVisible(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                )
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")
            elif app.status == PkgStates.REMOVING:
                self.ui.btn.setEnabled(False)
                #self.ui.btn.setText("正在卸载")
                self.ui.btn.setText(_("Uninstalling"))
                # self.ui.isInstalled.setVisible(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#e95421;}"
                )
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-un-border.png');}")
            elif app.status == PkgStates.UPGRADING:
                self.ui.btn.setEnabled(False)
                #self.ui.btn.setText("正在升级")
                self.ui.btn.setText(_("upgrading"))
                # self.ui.isInstalled.setVisible(False)
                self.ui.btn.setStyleSheet(
                    "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#07c30b;}"
                )
                # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-up-border.png');}")
            else:
                if (self.app.is_installed):
                    if (run.get_run_command(self.app.name) == ""):
                        self.app.status = PkgStates.NORUN
                        #self.ui.btn.setText("已安装")
                        self.ui.btn.setText(_("Aldy install"))
                        self.ui.btn.setEnabled(False)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:12px;color:#000000;border:0px;background-color:#ffffff;}"
                        )
                        # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-un-border.png');}")
                    else:
                        self.app.status = PkgStates.RUN
                        #self.ui.btn.setText("启动")
                        self.ui.btn.setText(_("Start"))
                        self.ui.btn.setEnabled(True)
                        self.ui.btn.setStyleSheet(
                            "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                        )
                        # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-run-border.png');}")
                else:
                    self.app.status = PkgStates.INSTALL
                    #self.ui.btn.setText("安装")
                    self.ui.btn.setText(_("Install"))
                    self.ui.btn.setEnabled(True)
                    self.ui.btn.setStyleSheet(
                        "QPushButton{font-size:12px;color:#000000;border:1px solid #d5d5d5;background-color:#ffffff;}QPushButton:hover{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}QPushButton:pressed{font-size:12px;color:#ffffff;border:1px solid #d5d5d5;background-color:#2d8ae1;}"
                    )
                    # self.ui.btnDetail.setStyleSheet("QPushButton{border:0px;background-image:url('res/wincard-install-border.png');}")

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
コード例 #22
0
    def __init__(self, app, nowpage, parent=None):
        QWidget.__init__(self,parent)
        self.ui_init()
        self.app = app
        self.workType = nowpage
        self.parent = parent

        self.ui.size.setAlignment(Qt.AlignRight)
        self.ui.installedsize.setAlignment(Qt.AlignRight)
        self.ui.size.setStyleSheet("QLabel{font-size:13px;}")
        self.ui.installedsize.setStyleSheet("QLabel{font-size:13px;}")
        self.ui.rating.setStyleSheet("QLabel{font-size:13px;color:#FF7D15;}")
        self.ui.ratingtext.setStyleSheet("QLabel{font-size:13px;}")
        self.ui.btn.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setFocusPolicy(Qt.NoFocus)
        self.ui.btnDetail.setText("详情")
        self.ui.btnDetail.hide()


        if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_ICON_PATH + app.name+".jpg"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".png"))
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg")):
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + app.name+".jpg"))
        else:
            self.ui.icon.setStyleSheet(ITEM_LABEL_STYLE % (UBUNTUKYLIN_RES_TMPICON_PATH + "default.png"))
        self.ui.btnDetail.setStyleSheet(RECOMMEND_BUTTON_STYLE %(UBUNTUKYLIN_RES_PATH+"btn6-1.png",UBUNTUKYLIN_RES_PATH+"btn6-2.png",UBUNTUKYLIN_RES_PATH+"btn6-3.png"))
        self.ui.name.setStyleSheet("QLabel{font-size:14px;font-weight:bold;}")
        self.ui.descr.setStyleSheet("QLabel{font-size:13px;color:#7E8B97;}")
        self.ui.installedVersion.setStyleSheet("QLabel{font-size:13px;}")
        self.ui.candidateVersion.setStyleSheet("QLabel{font-size:13px;color:#FF7D15;}")
        self.ui.btn.setStyleSheet(LIST_BUTTON_STYLE % (UBUNTUKYLIN_RES_PATH+"btn-small2-1.png",UBUNTUKYLIN_RES_PATH+"btn-small2-2.png",UBUNTUKYLIN_RES_PATH+"btn-small2-3.png") )

        self.ui.name.setText(app.name)
        summ = app.summary
        # if len(summ) > 31:
        #     summ = summ[:30]
        #     summ += "..."
        self.ui.descr.setText(summ)

        # size = app.packageSize
        # sizek = size / 1024
        # if(sizek < 1024):
        #     self.ui.size.setText(str(sizek) + " KB")
        # else:
        #     self.ui.size.setText(str('%.2f'%(sizek/1024.0)) + " MB")
        self.ui.size.setAlignment(Qt.AlignCenter)
        self.ui.size.setText("安装后:")

#        print "########item size:",app.name,app.packageSize,app.installedSize
        installedsize = app.installedSize
        installedsizek = installedsize / 1024
        if(installedsizek < 1024):
            self.ui.installedsize.setText(str(installedsizek) + " KB")
        else:
            self.ui.installedsize.setText(str('%.2f'%(installedsizek/1024.0)) + " MB")

        #????放置平均得分和评论人数
 #       print "ListItemWidget: ", self.app.name, self.app.rnrStat
 #        if app.rnrStat is not None:
 #            ratings_average = app.rnrStat.ratings_average
 #            ratings_total = app.rnrStat.ratings_total
 #            print "评分评论:",app.name, ratings_average, ratings_total

        self.ui.candidateVersion.setText("最新: " + app.candidate_version)
        # self.ui.candidateVersion.setText("<font color='#FF7D15'>最新: " + software.candidate_version + "</font>")

        self.star = StarWidget('small', app.ratings_average, self)
        self.star.move(508, 17)
        ratingstr = str(app.ratings_average)
        if(len(ratingstr) > 3):
            ratingstr = ratingstr[0:3]
        self.ui.rating.setText(ratingstr)
        self.ui.ratingtext.setText('分')

        if(nowpage == 'homepage'):
            self.ui.btn.setVisible(True)
            if(app.is_installed):
                self.ui.installedVersion.setText("已装: " + app.installed_version)
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btn.setText("已安装")
                    self.ui.btn.setEnabled(False)
                else:
                    self.ui.btn.setText("启动")
            else:
                self.ui.btn.setText("安装")
                self.ui.installedVersion.setText("未安装")
        elif(nowpage == 'uppage'):
            self.ui.btn.setVisible(True)
            self.ui.btn.setText("升级")
            self.ui.installedVersion.setText("已装: " + app.installed_version)
        elif(nowpage == 'unpage'):
            self.ui.btn.setVisible(True)
            self.ui.btn.setText("卸载")
            self.ui.installedVersion.setText("已装: " + app.installed_version)
        elif(nowpage == 'searchpage'):
            self.ui.btn.setVisible(False)

        self.ui.btn.clicked.connect(self.slot_btn_click)
        self.ui.btnDetail.clicked.connect(self.slot_emit_detail)
        self.connect(self.parent,Signals.apt_process_finish,self.slot_work_finished)
        self.connect(self.parent,Signals.apt_process_cancel,self.slot_work_cancel)
コード例 #23
0
    def slot_work_cancel(self, pkgname, action):
        if self.app is None:
            return

        if self.app.name == pkgname:

            self.ui.status.show()

            if action == AppActions.INSTALL:
                if self.app.is_upgradable:
                    self.ui.btnUpdate.setText("升级")#可
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnUpdate.setEnabled(True)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(False)
                    self.ui.btnUpdate.setVisible(True)
                    self.ui.btnUninstall.setVisible(False)
                else:
                    self.ui.btnUpdate.setText("不可升级")
                    self.ui.btnInstall.setText("安装")
                    self.ui.btnInstall.setEnabled(True)
                    self.ui.btnUpdate.setEnabled(False)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(True)
                    self.ui.btnUpdate.setVisible(False)
                    self.ui.btnUninstall.setVisible(False)

            elif action == AppActions.REMOVE:
                self.ui.btnUninstall.setText("卸载")#可
                self.ui.btnInstall.setEnabled(False)
                self.ui.btnUpdate.setEnabled(False)
                self.ui.btnUninstall.setEnabled(True)
                self.ui.btnInstall.setVisible(False)
                self.ui.btnUpdate.setVisible(False)
                self.ui.btnUninstall.setVisible(True)

            elif action == AppActions.UPGRADE:
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btnInstall.setText("已安装")
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnUpdate.setEnabled(False)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(True)
                    self.ui.btnUpdate.setVisible(False)
                    self.ui.btnUninstall.setVisible(False)
                else:
                    if self.app.is_upgradable:
                        self.ui.btnUpdate.setText("升级")#可
                        self.ui.btnInstall.setEnabled(False)
                        self.ui.btnUpdate.setEnabled(True)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(False)
                        self.ui.btnUpdate.setVisible(True)
                        self.ui.btnUninstall.setVisible(False)
                    else:
                        self.ui.btnInstall.setText("启动")
                        self.ui.btnUpdate.setText("不可升级")
                        self.ui.btnInstall.setEnabled(True)
                        self.ui.btnUpdate.setEnabled(False)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(True)
                        self.ui.btnUpdate.setVisible(False)
                        self.ui.btnUninstall.setVisible(False)
コード例 #24
0
    def slot_work_finished(self, pkgname, action):
        #add this to prevent slot received from other signal before show_detail is not called
        if self.app is None:
            return

        if self.app.name == pkgname:

            self.ui.status.show()

            if action == AppActions.INSTALLDEBFILE:
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnInstall.setText("已安装")
                else:
                    self.ui.btnInstall.setEnabled(True)
                    self.ui.btnInstall.setText("启动")
                self.ui.btnUpdate.setEnabled(False)
                self.ui.btnUninstall.setEnabled(False)
                self.ui.btnInstall.setVisible(True)
                self.ui.btnUpdate.setVisible(False)
                self.ui.btnUninstall.setVisible(False)

            elif action == AppActions.INSTALL:
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btnInstall.setText("已安装")
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnUpdate.setEnabled(False)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(True)
                    self.ui.btnUpdate.setVisible(False)
                    self.ui.btnUninstall.setVisible(False)
                else:
                    self.ui.btnInstall.setVisible(True)
                    if self.app.is_upgradable:
                        self.ui.btnUpdate.setText("升级")#可
                        self.ui.btnInstall.setEnabled(False)
                        self.ui.btnUpdate.setEnabled(True)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(False)
                        self.ui.btnUpdate.setVisible(True)
                        self.ui.btnUninstall.setVisible(False)
                    else:
                        self.ui.btnInstall.setText("启动")
                        self.ui.btnUpdate.setText("不可升级")
                        self.ui.btnInstall.setEnabled(True)
                        self.ui.btnUpdate.setEnabled(False)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(True)
                        self.ui.btnUpdate.setVisible(False)
                        self.ui.btnUninstall.setVisible(False)

            elif action == AppActions.REMOVE:
                self.ui.btnInstall.setText("安装")
                self.ui.btnUpdate.setText("不可升级")
                self.ui.btnUninstall.setText("卸载")#已
                self.ui.btnInstall.setEnabled(False)
                self.ui.btnUpdate.setEnabled(False)
                self.ui.btnUninstall.setEnabled(True)
                self.ui.btnInstall.setVisible(False)
                self.ui.btnUpdate.setVisible(False)
                self.ui.btnUninstall.setVisible(True)

            elif action == AppActions.UPGRADE:
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btnInstall.setText("已安装")
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnUpdate.setEnabled(False)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(True)
                    self.ui.btnUpdate.setVisible(False)
                    self.ui.btnUninstall.setVisible(False)
                else:
                    if self.app.is_upgradable:
                        self.ui.btnUpdate.setText("升级")#可
                        self.ui.btnInstall.setEnabled(False)
                        self.ui.btnUpdate.setEnabled(True)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(False)
                        self.ui.btnUpdate.setVisible(True)
                        self.ui.btnUninstall.setVisible(False)
                    else:
                        self.ui.btnInstall.setText("启动")
                        self.ui.btnUpdate.setText("不可升级")
                        self.ui.btnInstall.setEnabled(True)
                        self.ui.btnUpdate.setEnabled(False)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(True)
                        self.ui.btnUpdate.setVisible(False)
                        self.ui.btnUninstall.setVisible(False)
コード例 #25
0
    def showSimple(self, app, nowpage):
        # clear reviews
        self.reviewpage = 1
        self.currentreviewready = False
        self.ui.reviewListWidget.clear()
        # self.detailWidget.resize(805, 790)
        # self.ui.reviewListWidget.resize(805, 0)
        self.detailWidget.resize(860, 790)
        self.ui.reviewListWidget.resize(860, 0)
        self.reviewload.move(self.ui.reviewListWidget.x(), self.ui.reviewListWidget.y())
        # clear sshot
        self.sshotcount = 0
        self.ui.thumbnail.hide()

        self.app = app
        self.ui.name.setText(app.name)
        self.ui.installedVersion.setText("当前版本: " + app.installed_version)
        self.ui.candidateVersion.setText("最新版本: " + app.candidate_version)
        self.ui.summary.setText(app.summary)
        self.ui.description.setText(app.description)

        if(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".png")):
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + str(app.name) + ".png')}")
        elif(os.path.isfile(UBUNTUKYLIN_RES_ICON_PATH + str(self.app.name) + ".jpg")):
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + str(app.name) + ".jpg')}")
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".png")):
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_TMPICON_PATH + str(app.name) + ".png')}")
        elif(os.path.isfile(UBUNTUKYLIN_RES_TMPICON_PATH + app.name + ".jpg")):
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_TMPICON_PATH + str(app.name) + ".jpg')}")
        else:
            self.ui.icon.setStyleSheet("QLabel{background-image:url('" + UBUNTUKYLIN_RES_ICON_PATH + "default.png')}")

        size = app.packageSize
        sizek = size / 1024
        if(sizek < 1024):
            self.ui.size.setText("下载大小: " + str(sizek) + " KB")
        else:
            self.ui.size.setText("下载大小: " + str('%.2f'%(sizek/1024.0)) + " MB")

        installedsize = app.installedSize
        installedsizek = installedsize / 1024
        if(installedsizek < 1024):
            self.ui.size_install.setText("安装大小: " + str(installedsizek) + " KB")
        else:
            self.ui.size_install.setText("安装大小: " + str('%.2f'%(installedsizek/1024.0)) + " MB")

        self.ui.gradeText1.setText("我的评分: ")
        # self.ui.gradeText2.setStyleSheet("QLabel{text-align:center;}")
        self.ui.gradeText2.setText((str(app.ratings_total)) + "人参加评分")
        # self.ui.commentNumber.setText("共 " + str(app.ratings_total) + " 条评论")
        # self.ui.gradeText3.setText("满分5分")
        # self.ui.grade.setStyleSheet("QLabel{text-align:center;}")
        self.ui.grade.setText(str(app.ratings_average))
        self.star = StarWidget('big', app.ratings_average, self.detailWidget)
        self.star.move(65, 665)
        self.star2 = StarWidget('big', app.ratings_average, self.detailWidget)
        self.star2.move(710, 653)

        if nowpage == "homepage" or nowpage == "winpage":
            if(app.is_installed):
                self.ui.status.setStyleSheet("QLabel{background-image:url('res/installed.png')}")
                self.ui.status.show()
                if(run.get_run_command(self.app.name) == ""):
                    self.ui.btnInstall.setEnabled(False)
                    self.ui.btnUpdate.setEnabled(False)
                    self.ui.btnUninstall.setEnabled(False)
                    self.ui.btnInstall.setVisible(True)
                    self.ui.btnUpdate.setVisible(False)
                    self.ui.btnUninstall.setVisible(False)
                    self.ui.btnInstall.setText("已安装")
                else:
                    if self.app.is_upgradable:
                        self.ui.btnUpdate.setText("升级")
                        self.ui.btnInstall.setEnabled(False)
                        self.ui.btnUpdate.setEnabled(True)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(False)
                        self.ui.btnUpdate.setVisible(True)
                        self.ui.btnUninstall.setVisible(False)
                    else:
                        self.ui.btnInstall.setText("启动")
                        self.ui.btnUpdate.setText("升级")
                        self.ui.btnInstall.setEnabled(True)
                        self.ui.btnUpdate.setEnabled(False)
                        self.ui.btnUninstall.setEnabled(False)
                        self.ui.btnInstall.setVisible(True)
                        self.ui.btnUpdate.setVisible(False)
                        self.ui.btnUninstall.setVisible(False)
            else:
                self.ui.status.hide()
                self.ui.btnInstall.setText("安装")
                self.ui.btnUpdate.setText("升级")
                self.ui.btnUninstall.setText("卸载")
                self.ui.btnInstall.setEnabled(True)
                self.ui.btnUpdate.setEnabled(False)
                self.ui.btnUninstall.setEnabled(False)
                self.ui.btnInstall.setVisible(True)
                self.ui.btnUpdate.setVisible(False)
                self.ui.btnUninstall.setVisible(False)
        elif nowpage == "allpage":
            self.ui.status.hide()
            self.ui.btnInstall.setText("安装")
            self.ui.btnUpdate.setText("升级")
            self.ui.btnUninstall.setText("卸载")
            self.ui.btnInstall.setEnabled(True)
            self.ui.btnUpdate.setEnabled(False)
            self.ui.btnUninstall.setEnabled(False)
            self.ui.btnInstall.setVisible(True)
            self.ui.btnUpdate.setVisible(False)
            self.ui.btnUninstall.setVisible(False)
        elif nowpage == "uppage":
            self.ui.status.hide()
            self.ui.btnInstall.setText("安装")
            self.ui.btnUpdate.setText("升级")
            self.ui.btnUninstall.setText("卸载")
            self.ui.btnInstall.setEnabled(False)
            self.ui.btnUpdate.setEnabled(True)
            self.ui.btnUninstall.setEnabled(False)
            self.ui.btnInstall.setVisible(False)
            self.ui.btnUpdate.setVisible(True)
            self.ui.btnUninstall.setVisible(False)
        elif nowpage == "unpage":
            self.ui.status.hide()
            self.ui.btnInstall.setText("安装")
            self.ui.btnUpdate.setText("升级")
            self.ui.btnUninstall.setText("卸载")
            self.ui.btnInstall.setEnabled(False)
            self.ui.btnUpdate.setEnabled(False)
            self.ui.btnUninstall.setEnabled(True)
            self.ui.btnInstall.setVisible(False)
            self.ui.btnUpdate.setVisible(False)
            self.ui.btnUninstall.setVisible(True)
        self.show()

        # show loading
        self.reviewload.start_loading()
        self.sshotload.start_loading()
        # send request
        self.mainwindow.appmgr.get_application_screenshots(app.name,UBUNTUKYLIN_RES_SCREENSHOT_PATH)
        self.mainwindow.appmgr.get_application_reviews(app.name)
コード例 #26
0
 def is_runnable(self):
     if (run.get_run_command(self.name) != ""):
         return True
     else:
         return False
コード例 #27
0
    def refresh_btns(self, app):
        self.app = app
        y = 0
        if isinstance(app, DebFile):#for local deb file
            if app.is_installable:
                self.setBtnEnabledPlus(self.ui.btnInstall, True)
                self.setBtnEnabledPlus(self.ui.btnRun, False)
                self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                self.ui.btnInstall.move(0, y)
                self.ui.btnRun.move(0, y + 41)
                self.ui.btnUpdate.move(0, y + 82)
                self.ui.btnUninstall.move(0, y + 123)
            else:
                self.setBtnEnabledPlus(self.ui.btnInstall, False)
                self.setBtnEnabledPlus(self.ui.btnRun, False)
                self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                self.ui.btnInstall.move(0, y)
                self.ui.btnRun.move(0, y + 41)
                self.ui.btnUpdate.move(0, y + 82)
                self.ui.btnUninstall.move(0, y + 123)

        else:# for apt deb file
            if(Globals.NOWPAGE in (PageStates.HOMEPAGE,PageStates.ALLPAGE,PageStates.WINPAGE,PageStates.TRANSPAGE,PageStates.SEARCHHOMEPAGE,PageStates.SEARCHALLPAGE,PageStates.SEARCHWINPAGE,PageStates.SEARCHUAPAGE,PageStates.SEARCHTRANSPAGE,PageStates.APKPAGE,PageStates.SEARCHAPKPAGE)):#zx11.27
                # if(type == PkgStates.NORUN):
                if app.is_instelled and run.get_run_command(self.app.name) == "":
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)

                    if (isinstance(app,DebFile)):#check is local debfile or not for after click install
                        self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                        self.ui.btnRun.move(0, y + 41)
                        self.ui.btnUninstall.move(0, y)
                        self.ui.btnUpdate.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                    else:
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnRun.move(0, 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y)
                            self.ui.btnUninstall.move(0, y + 41)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnRun.move(0, y + 41)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 82)
                            self.ui.btnUninstall.move(0, y)
                elif app.is_instelled and run.get_run_command(self.app.name) != "":
                    self.setBtnEnabledPlus(self.ui.btnRun, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)

                    if (isinstance(app,DebFile)):#check is local debfile or not for after click install
                        self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                        self.ui.btnRun.move(0, y)
                        self.ui.btnUninstall.move(0, y + 41)
                        self.ui.btnUpdate.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                    else:
                        if app.is_upgradable:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnRun.move(0, y)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 41)
                            self.ui.btnUninstall.move(0, y + 82)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnRun.move(0, y)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 82)
                            self.ui.btnUninstall.move(0, y + 41)

                elif app.is_installed is False:
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                    self.ui.btnInstall.move(0, y)
                    self.ui.btnRun.move(0, y + 41)
                    self.ui.btnUpdate.move(0, y + 82)
                    self.ui.btnUninstall.move(0, y + 123)
                elif app.is_upgradable:#zx12.03 for update cancel in other page or app.status in listitemwedgt
                    if run.get_run_command(app.name) == "":
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        self.ui.btnRun.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnUninstall.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        self.ui.btnRun.move(0, y)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y + 41)
                        self.ui.btnUninstall.move(0, y + 82)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)

                elif app.is_installed:#zx12.06 for app.status in listitemwdge(just for homepage)
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y)
                            self.ui.btnUninstall.move(0, y + 41)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y)
                            self.ui.btnUninstall.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnRun.move(0, y)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 41)
                            self.ui.btnUninstall.move(0, y + 82)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnRun.move(0, y)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 82)
                            self.ui.btnUninstall.move(0, y + 41)

                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)

            elif(Globals.NOWPAGE == PageStates.UPPAGE or Globals.NOWPAGE == PageStates.SEARCHUPPAGE):
                if app.is_upgradable:
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnRun.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUninstall.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnRun.move(0, y + 41)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUninstall.move(0, y + 82)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                elif app.is_installed is False:
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.ui.btnUpdate.move(0, y + 41)
                    self.ui.btnRun.move(0, y + 123)
                    self.ui.btnInstall.move(0, y)
                    self.ui.btnUninstall.move(0, y + 82)
                elif app.is_instelled and run.get_run_command(self.app.name) == "":
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.ui.btnUpdate.move(0, y + 82)
                    self.ui.btnRun.move(0, y + 41)
                    self.ui.btnInstall.move(0, y + 123)
                    self.ui.btnUninstall.move(0, y)
                elif app.is_instelled and run.get_run_command(self.app.name) != "":
                    self.setBtnEnabledPlus(self.ui.btnRun, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.ui.btnUpdate.move(0, y + 82)
                    self.ui.btnRun.move(0, y)
                    self.ui.btnInstall.move(0, y + 123)
                    self.ui.btnUninstall.move(0, y + 41)

            elif(Globals.NOWPAGE == PageStates.UNPAGE or Globals.NOWPAGE == PageStates.SEARCHUNPAGE):
                if self.app.is_installed:
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnUpdate.move(0, y + 41)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUninstall.move(0, y)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnUpdate.move(0, y + 41)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUninstall.move(0, y)

                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnUpdate.move(0, y + 41)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUninstall.move(0, y)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnUpdate.move(0, y + 82)
                            self.ui.btnRun.move(0, y + 41)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUninstall.move(0, y)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)

                elif app.is_instelled is False:
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.ui.btnUpdate.move(0, y + 41)
                    self.ui.btnRun.move(0, y + 82)
                    self.ui.btnInstall.move(0, y)
                    self.ui.btnUninstall.move(0, y + 123)

                elif app.is_instelled and run.get_run_command(self.app.name) == "":
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.ui.btnUpdate.move(0, y + 41)
                    self.ui.btnRun.move(0, y + 82)
                    self.ui.btnInstall.move(0, y + 123)
                    self.ui.btnUninstall.move(0, y)
                elif app.is_instelled and run.get_run_command(self.app.name) != "":
                    self.setBtnEnabledPlus(self.ui.btnRun, True)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.ui.btnUpdate.move(0, y + 82)
                    self.ui.btnRun.move(0, y + 41)
                    self.ui.btnInstall.move(0, y + 123)
                    self.ui.btnUninstall.move(0, y)
                elif app.is_upgradable:#zx12.03 for update cancel in other page (why there isn't uninstall ,because uninstall can't be canceled)
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        self.ui.btnUninstall.move(0, y)
                        self.ui.btnRun.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.ui.btnUninstall.move(0, y)
                    self.ui.btnRun.move(0, y + 41)
                    self.ui.btnInstall.move(0, y + 123)
                    self.ui.btnUpdate.move(0, y + 82)

            elif(Globals.NOWPAGE == PageStates.UAPAGE): #zx.28 To keep the btn status change normally in UAPAGE
                if app.is_instelled and run.get_run_command(self.app.name) == "":
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    if app.is_upgradable is True:
                        self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                        self.ui.btnRun.move(0, 82)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnUninstall.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                        self.ui.btnRun.move(0, y + 41)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y + 82)
                        self.ui.btnUninstall.move(0, y)
                elif app.is_instelled and run.get_run_command(self.app.name) != "":
                    self.setBtnEnabledPlus(self.ui.btnRun, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    if app.is_upgradable:
                        self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                        self.ui.btnRun.move(0, y)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y + 41)
                        self.ui.btnUninstall.move(0, y + 82)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                        self.ui.btnRun.move(0, y)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUpdate.move(0, y + 82)
                        self.ui.btnUninstall.move(0, y + 41)

                elif app.is_installed is False:
                    self.setBtnEnabledPlus(self.ui.btnRun, False)
                    self.setBtnEnabledPlus(self.ui.btnInstall, True)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, False)
                    self.ui.btnInstall.move(0, y)
                    self.ui.btnRun.move(0, y + 41)
                    self.ui.btnUpdate.move(0, y + 82)
                    self.ui.btnUninstall.move(0, y + 123)
                elif app.is_installed:
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnUninstall.move(0, y + 41)
                            self.ui.btnRun.move(0, y + 82)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnUninstall.move(0, y)
                            self.ui.btnRun.move(0, y + 41)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 82)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        if app.is_upgradable is True:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                            self.ui.btnUninstall.move(0, y +82)
                            self.ui.btnRun.move(0, y + 41)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y)
                        else:
                            self.setBtnEnabledPlus(self.ui.btnUpdate, False)
                            self.ui.btnUninstall.move(0, y)
                            self.ui.btnRun.move(0, y + 41)
                            self.ui.btnInstall.move(0, y + 123)
                            self.ui.btnUpdate.move(0, y + 82)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)

                if app.is_upgradable:
                    if(run.get_run_command(app.name) == ""):
                        self.setBtnEnabledPlus(self.ui.btnRun, False)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnRun.move(0, y + 82)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUninstall.move(0, y + 41)
                    else:
                        self.setBtnEnabledPlus(self.ui.btnRun, True)
                        self.ui.btnUpdate.move(0, y)
                        self.ui.btnRun.move(0, y + 41)
                        self.ui.btnInstall.move(0, y + 123)
                        self.ui.btnUninstall.move(0, y + 82)
                    self.setBtnEnabledPlus(self.ui.btnUpdate, True)
                    self.setBtnEnabledPlus(self.ui.btnUninstall, True)
                    self.setBtnEnabledPlus(self.ui.btnInstall, False)