예제 #1
0
    def __init__(self,
                 dataBaseType: JPDbType = JPDbType.MySQL,
                 *args,
                 **kwargs):
        super(JPMainWindow, self).__init__(*args, **kwargs)
        try:
            db = JPDb()
            db.setDatabaseType(dataBaseType)
            JPPub().MainForm = self
        except Exception as e:
            QMessageBox.warning(self, "提示", str(e))

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.label_Title.setText("")
        self.commandDict = {}
        self.logoPixmap = None

        self.addOneButtonIcon(self.ui.ChangeUser, "changeuser.png")
        self.addOneButtonIcon(self.ui.ChangePassword, "changepassword.png")
        # self.addLogoToLabel(self.ui.label_logo)

        # 用户及密码修改功能
        objUser = JPUser()
        objUser.INIT()  # 程序开始时只初始化一次
        objUser.userChange.connect(self.onUserChanged)
        objUser.currentUserID()
        self.ui.ChangeUser.clicked.connect(objUser.changeUser)
        self.ui.ChangePassword.clicked.connect(objUser.changePassword)

        # 堆叠布局
        self.ui.stackedWidget.removeWidget(self.ui.page)
        self.ui.stackedWidget.removeWidget(self.ui.page_2)

        # 隐藏树标题
        self.ui.label_FunPath.setText('')
        self.ui.treeWidget.setHeaderHidden(True)

        # 设置状态条中的进度条及标签
        self.Label = QLabel(" ")
        self.ProgressBar = QProgressBar()
        self.statusBar = self.statusBar()
        self.statusBar.addPermanentWidget(self.Label)
        self.statusBar.addPermanentWidget(self.ProgressBar)
        self.ProgressBar.setGeometry(0, 0, 100, 5)
        self.ProgressBar.hide()
        self.statusBar.hide()

        self.ui.splitter.setStretchFactor(0, 2)
        self.ui.splitter.setStretchFactor(1, 11)

        # 连接点击了功能树中的节点到函数
        self.ui.treeWidget.itemClicked[QTreeWidgetItem,
                                       int].connect(self.treeViewItemClicked)
예제 #2
0
    def __init__(self):
        super().__init__()
        JPPub().MainForm = self
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.label_Title.setText("Zion OrderM")
        #self.ui.label_Title.setText("ColorPro OrderM")
        #self.setWindowTitle("ColorPro OrderM")
        self.setWindowTitle("Zion OrderM")

        # self.icoPath = ":/pic/res/ico/{}"
        # self.logoPath = ":/logo/res/{}"
        self.icoPath = getcwd() + "\\res\\ico\\{}"
        self.logoPath = getcwd() + "\\res\\{}"

        # 设置主窗体中按钮图标及Logo
        self.logoPixmap = QPixmap(self.logoPath.format("zions_100.png"))
        self.backPixmap = QPixmap(self.logoPath.format("zions_tm.png"))
        self.addOneButtonIcon(self.ui.ChangeUser, "changeuser.png")
        self.addOneButtonIcon(self.ui.ChangePassword, "changepassword.png")
        self.addLogoToLabel(self.ui.label_logo)

        # 用户及密码修改功能
        objUser = JPUser()
        objUser.INIT()  # 程序开始时只初始化一次
        objUser.userChange.connect(self.onUserChanged)
        objUser.currentUserID()
        self.ui.ChangeUser.clicked.connect(objUser.changeUser)
        self.ui.ChangePassword.clicked.connect(objUser.changePassword)

        # 堆叠布局
        self.ui.stackedWidget.removeWidget(self.ui.page)
        self.ui.stackedWidget.removeWidget(self.ui.page_2)

        # 隐藏树标题
        self.ui.label_FunPath.setText('')
        self.ui.treeWidget.setHeaderHidden(True)

        # 设置状态条中的进度条及标签
        self.Label = QLabel("")
        self.ProgressBar = QProgressBar()
        self.statusBar().addPermanentWidget(self.Label)
        self.statusBar().addPermanentWidget(self.ProgressBar)
        self.ProgressBar.hide()

        # 连接点击了功能树中的节点到函数
        self.ui.treeWidget.itemClicked[QTreeWidgetItem,
                                       int].connect(self.treeViewItemClicked)