Beispiel #1
0
 def set_ButtonImage(self):
     self.openFilesPath = QtCore.QString(os.getcwd() + os.sep + 'images')
     filename = QtGui.QFileDialog.getOpenFileName(self,
         "Choose a picture", self.openFilesPath,
         "All Files (*);; Images (*.png *.bmp *.jpg)")
     style = 'QPushButton {border-image : url(%s);}' % str(QtCore.QDir(QtCore.QDir.currentPath()).relativeFilePath(filename))
     set_skin(self.parent, os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']), style)
Beispiel #2
0
 def set_BackGroundColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QMainWindow {background : rgb(%s,%s,%s);}' % (
         bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent.parent(),
              os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']), style)
Beispiel #3
0
    def createButtons(self):
        self.ToolButtons = [
            [u'BackGroundColor', u'BackGroundImage'],
            ['ButtonColor', 'ButtonImage'],
        ]
        self.buttontext = {
            'BackGroundColor': u'窗口背景颜色',
            'BackGroundImage': u'窗口背景图片',
            'ButtonColor': u'磁贴背景颜色',
            'ButtonImage': u'磁贴背景图片',
        }
        buttonLayout = QtGui.QGridLayout()
        for buttons in self.ToolButtons:
            for item in buttons:
                button = item + 'Button'
                setattr(self, button, QtGui.QPushButton(self.buttontext[item]))
                getattr(self, button).setObjectName(button)
                getattr(self,
                        button).clicked.connect(getattr(self, 'set_' + item))
                buttonLayout.addWidget(getattr(self, button),
                                       self.ToolButtons.index(buttons),
                                       buttons.index(item))

        self.setLayout(buttonLayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'MetroToolPage.qss']))
Beispiel #4
0
 def set_BackGroundImage(self):
     self.openFilesPath = QtCore.QString(os.getcwd() + os.sep + 'images')
     filename = QtGui.QFileDialog.getOpenFileName(self,
         "Choose a picture", self.openFilesPath,
         "All Files (*);; Images (*.png *.bmp *.jpg)")
     style = 'QMainWindow {border-image : url(%s);}' % str(QtCore.QDir(QtCore.QDir.currentPath()).relativeFilePath(filename))
     set_skin(self.parent.parent(), os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']), style)
Beispiel #5
0
    def __init__(self, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        ipaddress_title = options['ipaddress_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(ipaddress_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(
            QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint
            | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # url内容输入
        self.urlwidget = QtGui.QWidget()
        ip_mainlayout = QtGui.QGridLayout()
        self.ipLabel = QtGui.QLabel(u'输入主机ip:')
        self.ipLineEdit = QtGui.QLineEdit(u'')
        self.ipLineEdit.setInputMask('000.000.000.000')
        self.portLabel = QtGui.QLabel(u'输入主机port:')
        self.portLineEdit = QtGui.QLineEdit(u'8000')
        ip_mainlayout.addWidget(self.ipLabel, 0, 0)
        ip_mainlayout.addWidget(self.ipLineEdit, 0, 1)
        ip_mainlayout.addWidget(self.portLabel, 1, 0)
        ip_mainlayout.addWidget(self.portLineEdit, 1, 1)

        self.urlwidget.setLayout(ip_mainlayout)

        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbEnter.clicked.connect(self.enter)
        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        # self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.urlwidget)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.msgflag = {}
Beispiel #6
0
    def __init__(self, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        ipaddress_title = options['ipaddress_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(ipaddress_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # url内容输入
        self.urlwidget = QtGui.QWidget()
        ip_mainlayout = QtGui.QGridLayout()
        self.ipLabel = QtGui.QLabel(u'输入主机ip:')
        self.ipLineEdit = QtGui.QLineEdit(u'')
        self.ipLineEdit.setInputMask('000.000.000.000')
        self.portLabel = QtGui.QLabel(u'输入主机port:')
        self.portLineEdit = QtGui.QLineEdit(u'8000')
        ip_mainlayout.addWidget(self.ipLabel, 0, 0)
        ip_mainlayout.addWidget(self.ipLineEdit, 0, 1)
        ip_mainlayout.addWidget(self.portLabel, 1, 0)
        ip_mainlayout.addWidget(self.portLineEdit, 1, 1)

        self.urlwidget.setLayout(ip_mainlayout)

        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbEnter.clicked.connect(self.enter)
        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        # self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.urlwidget)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.msgflag = {}
Beispiel #7
0
 def set_ButtonColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QPushButton {background : rgb(%s,%s,%s);}' % (
         bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent,
              os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']),
              style)
     set_skin(self, os.sep.join(['skin', 'qss', 'MetroToolBar.qss']), style)
Beispiel #8
0
 def set_BackGroundImage(self):
     self.openFilesPath = QtCore.QString(os.getcwd() + os.sep + 'images')
     filename = QtGui.QFileDialog.getOpenFileName(
         self, "Choose a picture", self.openFilesPath,
         "All Files (*);; Images (*.png *.bmp *.jpg)")
     style = 'QMainWindow {border-image : url(%s);}' % str(
         QtCore.QDir(QtCore.QDir.currentPath()).relativeFilePath(filename))
     set_skin(self.parent.parent(),
              os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']), style)
Beispiel #9
0
 def set_ButtonImage(self):
     self.openFilesPath = QtCore.QString(os.getcwd() + os.sep + 'images')
     filename = QtGui.QFileDialog.getOpenFileName(
         self, "Choose a picture", self.openFilesPath,
         "All Files (*);; Images (*.png *.bmp *.jpg)")
     style = 'QPushButton {border-image : url(%s);}' % str(
         QtCore.QDir(QtCore.QDir.currentPath()).relativeFilePath(filename))
     set_skin(self.parent,
              os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']),
              style)
    def setskin(self):
        set_skin(self.centeralwindow, os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']))  # 设置导航页面样式

        for buttons in self.centeralwindow.MetroButtons:
            for item in buttons:
                childpage = getattr(self.centeralwindow, 'child' + item + 'Page')
                set_skin(childpage, os.sep.join(['skin', 'qss', 'MetroTopToolBar.qss']))   # 设置导航工具条的样式

        for page in ['MatPlotLib', 'GuiQwt', 'PyQtGraph']:
            page = getattr(self.centeralwindow, page + 'Page')
            set_skin(page, os.sep.join(['skin', 'qss', 'MetroPlotItemLeftControl.qss']))  # 设置波形页面左侧工具条样式

        set_skin(getattr(self.centeralwindow, 'DBPage'), os.sep.join(['skin', 'qss', 'MetroDBPage.qss']))  # 设置主窗口样式

        set_skin(self, os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']))  # 设置主窗口样式
Beispiel #11
0
    def __init__(self, text, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        msg_title = options['msg_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(msg_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(
            QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint
            | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # message内容提示
        self.msglabel = QtGui.QLabel(text)
        # self.msglabel.setAlignment(QtCore.Qt.AlignCenter)
        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbEnter.clicked.connect(self.enter)
        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        # self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.msglabel)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.msgflag = {}
Beispiel #12
0
    def __init__(self, parent=None, child=None):
        super(ChildDialog, self).__init__(parent)
        self.parent = parent
        self.child = child
        self.createNavigation()

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.child)
        mainLayout.addWidget(self.navigation)
        self.setLayout(mainLayout)
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化
        self.setModal(True)
        set_skin(self, os.sep.join(['skin', 'qss', 'MetroDialog.qss']))  # 设置弹出框样式
        self.setWindowIcon(QtGui.QIcon('skin/icons/light/appbar.cog.png'))
Beispiel #13
0
    def __init__(self, text, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        msg_title = options['msg_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(msg_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # message内容提示
        self.msglabel = QtGui.QLabel(text)
        # self.msglabel.setAlignment(QtCore.Qt.AlignCenter)
        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbEnter.clicked.connect(self.enter)
        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        # self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.msglabel)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.msgflag = {}
Beispiel #14
0
    def createButtons(self):
        self.ToolButtons = [
            [u'BackGroundColor', u'BackGroundImage'],
            ['ButtonColor', 'ButtonImage'],
        ]
        self.buttontext = {
            'BackGroundColor': u'窗口背景颜色',
            'BackGroundImage': u'窗口背景图片',
            'ButtonColor': u'磁贴背景颜色',
            'ButtonImage': u'磁贴背景图片',
        }
        buttonLayout = QtGui.QGridLayout()
        for buttons in self.ToolButtons:
            for item in buttons:
                button = item + 'Button'
                setattr(self, button, QtGui.QPushButton(self.buttontext[item]))
                getattr(self, button).setObjectName(button)
                getattr(self, button).clicked.connect(getattr(self, 'set_' + item))
                buttonLayout.addWidget(getattr(self, button), self.ToolButtons.index(buttons), buttons.index(item))

        self.setLayout(buttonLayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'MetroToolPage.qss']))
Beispiel #15
0
    def setskin(self):
        set_skin(self.centeralwindow, os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']))  # 设置导航页面样式

        for buttons in windowsoptions['mainwindow']['centralwindow']['page_tag']:
            for item in buttons:
                childpage = getattr(self.centeralwindow, 'child' + item + 'Page')
                set_skin(childpage, os.sep.join(['skin', 'qss', 'MetroNavigationBar.qss']))   # 设置导航工具条的样式

        set_skin(self, os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']))  # 设置主窗口样式
Beispiel #16
0
    def __init__(self, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        exit_title = options['exit_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(exit_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(
            QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint
            | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # 退出设置
        self.exitoptwidget = QtGui.QWidget()
        exit_mainlayout = QtGui.QGridLayout()

        self.exitradiogroup = QtGui.QButtonGroup(self.exitoptwidget)
        self.minRadio = QtGui.QRadioButton(u'最小化')
        self.exitRadio = QtGui.QRadioButton(u'退出')
        self.exitsaveRadio = QtGui.QRadioButton(u'退出并保存配置')
        self.exitradiogroup.addButton(self.minRadio)
        self.exitradiogroup.addButton(self.exitRadio)
        self.exitradiogroup.addButton(self.exitsaveRadio)

        exit_mainlayout.addWidget(self.minRadio, 0, 0)
        exit_mainlayout.addWidget(self.exitRadio, 1, 0)
        exit_mainlayout.addWidget(self.exitsaveRadio, 2, 0)
        self.exitoptwidget.setLayout(exit_mainlayout)
        self.exitsaveRadio.setChecked(True)

        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbEnter.clicked.connect(self.exit)
        self.pbCancel.clicked.connect(self.close)

        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.exitoptwidget)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.exitflag = {}
Beispiel #17
0
 def set_ButtonColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QPushButton {background : rgb(%s,%s,%s);}' % (bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent, os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']), style)
     set_skin(self, os.sep.join(['skin', 'qss', 'MetroToolBar.qss']), style)
Beispiel #18
0
 def set_BackGroundColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QMainWindow {background : rgb(%s,%s,%s);}' % (bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent.parent(), os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']), style)
Beispiel #19
0
    def __init__(self, options, parent=None):
        QtGui.QDialog.__init__(self, parent)

        exit_title = options['exit_title']
        windowicon = options['windowicon']
        minsize = options['minsize']
        size = options['size']
        logo_title = options['logo_title']
        logo_img_url = options['logo_img_url']

        self.setWindowTitle(exit_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        # logo显示
        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        # 退出设置
        self.exitoptwidget = QtGui.QWidget()
        exit_mainlayout = QtGui.QGridLayout()

        self.exitradiogroup = QtGui.QButtonGroup(self.exitoptwidget)
        self.minRadio = QtGui.QRadioButton(u'最小化')
        self.exitRadio = QtGui.QRadioButton(u'退出')
        self.exitsaveRadio = QtGui.QRadioButton(u'退出并保存配置')
        self.exitradiogroup.addButton(self.minRadio)
        self.exitradiogroup.addButton(self.exitRadio)
        self.exitradiogroup.addButton(self.exitsaveRadio)

        exit_mainlayout.addWidget(self.minRadio, 0, 0)
        exit_mainlayout.addWidget(self.exitRadio, 1, 0)
        exit_mainlayout.addWidget(self.exitsaveRadio, 2, 0)
        self.exitoptwidget.setLayout(exit_mainlayout)
        self.exitsaveRadio.setChecked(True)

        # 退出按钮布局
        self.login_lc = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbEnter.clicked.connect(self.exit)
        self.pbCancel.clicked.connect(self.close)

        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbEnter, 0, 0)
        self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        self.login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(self.exitoptwidget)
        mainlayout.addWidget(self.login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])
        self.exitflag = {}
Beispiel #20
0
    def __init__(self, loginoptions, parent=None):
        QtGui.QDialog.__init__(self, parent)

        login_title = loginoptions['login_title']
        windowicon = loginoptions['windowicon']
        minsize = loginoptions['minsize']
        size = loginoptions['size']
        logo_title = loginoptions['logo_title']
        logo_img_url = loginoptions['logo_img_url']

        self.setWindowTitle(login_title)
        self.setWindowIcon(QtGui.QIcon(windowicon))  # 设置程序图标
        self.setMinimumSize(minsize[0], minsize[1])

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)  # 无边框, 带系统菜单, 可以最小化

        self.login_logo = QtGui.QWidget()
        login_logo_mainlayout = QtGui.QGridLayout()
        login_bg = QtGui.QLabel(logo_title)
        login_bg.setObjectName('logo_bg')
        login_bg.setAlignment(QtCore.Qt.AlignCenter)
        login_logo_mainlayout.addWidget(login_bg)
        self.login_logo.setLayout(login_logo_mainlayout)
        self.login_bg = logo_img_url
        setbg(self.login_logo, self.login_bg)

        login_np = QtGui.QWidget()
        login_np_mainlayout = QtGui.QGridLayout()
        login_nameLabel = QtGui.QLabel(u'用户名')
        self.login_name = QtGui.QLineEdit(self)
        self.login_name.setPlaceholderText(u'用户名')

        login_passwordLabel = QtGui.QLabel(u'密码')
        self.login_password = QtGui.QLineEdit(self)
        self.login_password.setEchoMode(QtGui.QLineEdit.Password)
        self.login_password.setPlaceholderText(u'密码')

        login_np_mainlayout.addWidget(login_nameLabel, 0, 0)
        login_np_mainlayout.addWidget(self.login_name, 0, 1)
        login_np_mainlayout.addWidget(login_passwordLabel, 1, 0)
        login_np_mainlayout.addWidget(self.login_password, 1, 1)
        login_np.setLayout(login_np_mainlayout)

        # 按钮布局
        login_lc = QtGui.QWidget()
        self.pbLogin = QtGui.QPushButton(u'登录', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbLogin.clicked.connect(self.login)
        self.pbCancel.clicked.connect(self.reject)

        self.login_lc__mainlayout = QtGui.QGridLayout()
        self.login_lc__mainlayout.addWidget(self.pbLogin, 0, 0)
        self.login_lc__mainlayout.addWidget(self.pbCancel, 0, 1)
        login_lc.setLayout(self.login_lc__mainlayout)

        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.login_logo)
        mainlayout.addWidget(login_np)
        mainlayout.addWidget(login_lc)
        self.setLayout(mainlayout)
        set_skin(self, os.sep.join(['skin', 'qss', 'login.qss']))  # 设置主窗口样式
        self.resize(size[0], size[1])