Ejemplo n.º 1
0
    def __init__(self, styleoptions, parent=None):
        super(numinputDialog, self).__init__(styleoptions, parent)

        # url内容输入
        self.numwidget = QtGui.QWidget()
        num_mainlayout = QtGui.QGridLayout()
        self.numLabel = QtGui.QLabel(u'Q的防区个数:')
        self.numspinbox = QtGui.QSpinBox(self.numwidget)

        self.ipLabel = QtGui.QLabel(u'Q的下位机IP:')
        self.ipIn = QtGui.QLineEdit()

        num_mainlayout.addWidget(self.numLabel, 0, 0)
        num_mainlayout.addWidget(self.numspinbox, 0, 1)
        #num_mainlayout.addWidget(self.ipLabel, 1, 0)
        #num_mainlayout.addWidget(self.ipIn, 1, 1)
        self.numwidget.setLayout(num_mainlayout)

        #确认按钮布局
        self.enterwidget = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbEnter.clicked.connect(self.enter)
        self.pbCancel.clicked.connect(self.reject)
        enterwidget_mainlayout = QtGui.QGridLayout()
        enterwidget_mainlayout.addWidget(self.pbEnter, 0, 0)
        enterwidget_mainlayout.addWidget(self.pbCancel, 0, 1)
        self.enterwidget.setLayout(enterwidget_mainlayout)

        self.layout().addWidget(self.numwidget)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())
Ejemplo n.º 2
0
    def __init__(self, styleoptions, parent=None):
        super(LoginDialog, self).__init__(styleoptions, parent)

        self.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)
        self.login_np.setLayout(login_np_mainlayout)

        #确认按钮布局
        self.enterwidget = 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)

        enterwidget_mainlayout = QtGui.QGridLayout()
        enterwidget_mainlayout.addWidget(self.pbLogin, 0, 0)
        enterwidget_mainlayout.addWidget(self.pbCancel, 0, 1)
        self.enterwidget.setLayout(enterwidget_mainlayout)

        self.layout().addWidget(self.login_np)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())
Ejemplo n.º 3
0
    def __init__(self, styleoptions, parent=None):
        super(IPaddressDialog, self).__init__(styleoptions, parent)

        # url内容输入
        self.urlwidget = QtGui.QWidget()
        ip_mainlayout = QtGui.QGridLayout()
        self.ipLabel = QtGui.QLabel(u'输入主机ip:')
        self.ipLineEdit = QtGui.QLineEdit(u'192.168.100.100')
        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.enterwidget = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbEnter.clicked.connect(self.enter)
        self.pbCancel.clicked.connect(self.reject)
        enterwidget_mainlayout = QtGui.QGridLayout()
        enterwidget_mainlayout.addWidget(self.pbEnter, 0, 0)
        enterwidget_mainlayout.addWidget(self.pbCancel, 0, 1)
        self.enterwidget.setLayout(enterwidget_mainlayout)

        self.layout().addWidget(self.urlwidget)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())
Ejemplo n.º 4
0
    def __init__(self, styleoptions, parent=None):
        super(UrlinputDialog, self).__init__(styleoptions, parent)

        # url内容输入
        self.urlwidget = QtGui.QWidget()
        url_mainlayout = QtGui.QGridLayout()
        self.urlLabel = QtGui.QLabel(u'请输入需要访问的url:')
        self.urlLineEdit = QtGui.QLineEdit(u'http://192.168.10.135:8000/webs/protection_areas/list')
        url_mainlayout.addWidget(self.urlLabel, 0, 0)
        url_mainlayout.addWidget(self.urlLineEdit, 1, 0)
        self.urlwidget.setLayout(url_mainlayout)

        #确认按钮布局
        self.enterwidget = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbCancel = QtGui.QPushButton(u'取消', self)
        self.pbEnter.clicked.connect(self.enter)
        self.pbCancel.clicked.connect(self.reject)
        enterwidget_mainlayout = QtGui.QGridLayout()
        enterwidget_mainlayout.addWidget(self.pbEnter, 0, 0)
        enterwidget_mainlayout.addWidget(self.pbCancel, 0, 1)
        self.enterwidget.setLayout(enterwidget_mainlayout)

        self.layout().addWidget(self.urlwidget)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())
Ejemplo n.º 5
0
    def createNavigationByPage(self):
        systembuttons = ['Min', 'Max', 'Close']
        navbutton = windowsoptions['mainwindow']['centralwindow']['pagetags'][
            0] + systembuttons
        navbutton_zh = windowsoptions['mainwindow']['centralwindow'][
            'pagetags_zh']
        self.navigation = QtGui.QWidget()
        navigationLayout = QtGui.QHBoxLayout()

        for item in navbutton:
            button = item + 'Button'
            if item not in systembuttons:
                setattr(self, button, QtGui.QPushButton(navbutton_zh[item]))
                getattr(self,
                        button).clicked.connect(self.parent.childpageChange)
            else:
                setattr(self, button, QtGui.QPushButton())

            getattr(self, button).setObjectName(button)
            navigationLayout.addWidget(getattr(self, button))
        self.navigation.setLayout(navigationLayout)
        self.navigation.setMaximumHeight(60)
        self.navigation.setContentsMargins(0, 0, 0, 0)

        getattr(self, 'Min' + 'Button').clicked.connect(
            self.parent.parent().showMinimized)
        getattr(self, 'Max' + 'Button').clicked.connect(
            self.parent.parent().windowMaxNormal)
        getattr(self,
                'Close' + 'Button').clicked.connect(self.parent.parent().close)
Ejemplo n.º 6
0
    def __init__(self, styleoptions, parent=None):
        super(BaseDialog2, self).__init__(parent)
        title = styleoptions['title']
        windowicon = styleoptions['windowicon']
        minsize = styleoptions['minsize']
        size = styleoptions['size']
        logo_title = styleoptions['logo_title']
        logo_img_url = styleoptions['logo_img_url']

        self.setWindowTitle(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.logowidget = QtGui.QWidget()
        logo_mainlayout = QtGui.QGridLayout()
        bg = QtGui.QLabel(logo_title)
        bg.setAlignment(QtCore.Qt.AlignCenter)
        logo_mainlayout.addWidget(bg)
        self.logowidget.setLayout(logo_mainlayout)
        self.bg = logo_img_url
        setbg(self.logowidget, self.bg)

        # 主布局
        mainlayout = QtGui.QVBoxLayout()
        mainlayout.addWidget(self.logowidget)
        self.setLayout(mainlayout)
        # setskin(self, os.sep.join([__file__.split('utildialog')[0], 'utildialogskin', 'qss', 'dialog.qss']))  # 设置主窗口样式
        setskin(self, 'D:\GitHub\QSoftKeyer\utildialogskin\qss\dialog.qss')
        self.resize(size[0], size[1])
Ejemplo n.º 7
0
    def __init__(self, styleoptions, parent=None):
        super(ExitDialog, self).__init__(styleoptions, parent)

        # 退出设置
        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.enterwidget = 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)

        enterwidget_mainlayout = QtGui.QGridLayout()
        enterwidget_mainlayout.addWidget(self.pbEnter, 0, 0)
        enterwidget_mainlayout.addWidget(self.pbCancel, 0, 1)
        self.enterwidget.setLayout(enterwidget_mainlayout)

        self.layout().addWidget(self.exitoptwidget)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())

        self.exitflag = {}
Ejemplo n.º 8
0
    def createcontrolbar(self):
        self.controlbar = QtGui.QWidget()
        controlbar_layout = QtGui.QGridLayout()

        self.pageLabel = QtGui.QLabel()
        exportmarkdownButton = QtGui.QPushButton(u'导出md')
        exportmarkdownButton.setObjectName('ExpmarkdownButton')
        exportmarkdownButton.setToolTip(u'导出md')
        self.exportmarkdownButton = exportmarkdownButton

        exporthtmlButton = QtGui.QPushButton(u'导出HTML')
        exporthtmlButton.setObjectName('ExphtmlButton')
        exporthtmlButton.setToolTip(u'导出')
        self.exporthtmlButton = exporthtmlButton

        exportpdfButton = QtGui.QPushButton(u'导出PDF')
        exportpdfButton.setObjectName('ExppdfButton')
        exportpdfButton.setToolTip(u'导出PDF')
        self.exportpdfButton = exportpdfButton

        n = 15
        blank1 = 3
        blank2 = 3
        for i in xrange(blank1):
            controlbar_layout.addWidget(QtGui.QLabel(), 0, i)

        themes = [
            item[5:] for item in windowsoptions['markdownthemes']['themes']
        ]
        for item in themes:
            button = 'Theme%sButton' % item
            setattr(self, button, QtGui.QPushButton(item))
            getattr(self, button).setObjectName(button)
            controlbar_layout.addWidget(getattr(self, button), 0,
                                        themes.index(item) + blank1)
            getattr(self, button).clicked.connect(self.settheme)

        for i in xrange(len(themes) + blank1, len(themes) + blank1 + blank2):
            controlbar_layout.addWidget(QtGui.QLabel(), 0, i)
        controlbar_layout.addWidget(exportmarkdownButton, 0, n - 4)
        controlbar_layout.addWidget(exporthtmlButton, 0, n - 3)
        controlbar_layout.addWidget(exportpdfButton, 0, n - 2)
        controlbar_layout.addWidget(QtGui.QLabel(), 0, n)
        self.controlbar.setLayout(controlbar_layout)
        controlbar_layout.setContentsMargins(0, 0, 0, 0)
        self.controlbar.setMaximumHeight(50)

        exportmarkdownButton.clicked.connect(self.exportmarkdown)
        exporthtmlButton.clicked.connect(self.exporthtml)
        exportpdfButton.clicked.connect(self.exportpdf)
Ejemplo n.º 9
0
    def __init__(self, text, styleoptions, parent=None):
        super(MessageDialog, self).__init__(styleoptions, parent)
        # message内容提示
        self.msglabel = QtGui.QLabel(text)
        self.msglabel.setAlignment(QtCore.Qt.AlignCenter)
        #确认按钮布局
        self.enterwidget = QtGui.QWidget()
        self.pbEnter = QtGui.QPushButton(u'确定', self)
        self.pbEnter.clicked.connect(self.enter)
        self.enter_mainlayout = QtGui.QGridLayout()
        self.enter_mainlayout.addWidget(self.pbEnter, 0, 0)
        self.enterwidget.setLayout(self.enter_mainlayout)

        self.layout().addWidget(self.msglabel)
        self.layout().addWidget(self.enterwidget)
        self.resize(self.width(), self.height())
Ejemplo n.º 10
0
    def createNavigation(self):
        navbutton = ['Navigation', 'Back', 'Forward', 'Min', 'Max', 'Close']
        navbutton_zh = {
            'Navigation': u'导航主页(Navigation)',
            'Back': u'后退(Back)',
            'Forward': u'前进(Forward)',
            'Min': u'',
            'Max': u'',
            'Close': u''
        }
        self.navigation = QtGui.QWidget()
        navigationLayout = QtGui.QHBoxLayout()

        for item in navbutton:
            button = item + 'Button'
            if item not in ['Min', 'Max', 'Close']:
                setattr(self, button, QtGui.QPushButton(navbutton_zh[item]))
            else:
                setattr(self, button, QtGui.QPushButton())
                getattr(self, button).setMaximumWidth(50)

            getattr(self, button).setObjectName(button)
            navigationLayout.addWidget(getattr(self, button))
        self.navigation.setLayout(navigationLayout)
        self.navigation.setMaximumHeight(60)
        self.navigation.setContentsMargins(0, 0, 0, 0)

        getattr(self, 'Navigation' + 'Button').clicked.connect(
            self.parent.backnavigationPage)
        getattr(self, 'Back' + 'Button').clicked.connect(self.parent.backPage)
        getattr(self, 'Forward' + 'Button').clicked.connect(
            self.parent.forwardnextPage)
        getattr(self, 'Min' + 'Button').clicked.connect(
            self.parent.parent().showMinimized)
        getattr(self, 'Max' + 'Button').clicked.connect(
            self.parent.parent().windowMaxNormal)
        getattr(self,
                'Close' + 'Button').clicked.connect(self.parent.parent().close)
Ejemplo n.º 11
0
    def _setup_views(self):
        """ Creates the UI widgets. 
        """
        self.central_splitter = QtGui.QSplitter(self,
                                                orientation=QtCore.Qt.Vertical)
        self.setCentralWidget(self.central_splitter)
        # central_layout = QtGui.QVBoxLayout()
        # self.central_splitter.setLayout(central_layout)

        # Tree widget
        self.obj_tree = ToggleColumnTreeView()
        self.obj_tree.setAlternatingRowColors(True)
        self.obj_tree.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.obj_tree.setUniformRowHeights(True)
        self.obj_tree.setAnimated(True)
        self.obj_tree.add_header_context_menu()

        # Stretch last column?
        # It doesn't play nice when columns are hidden and then shown again.
        obj_tree_header = self.obj_tree.header()
        # obj_tree_header.setMovable(True)
        obj_tree_header.setStretchLastSection(False)
        for action in self.obj_tree.toggle_column_actions_group.actions():
            self.show_cols_submenu.addAction(action)

        self.central_splitter.addWidget(self.obj_tree)

        # Bottom pane
        bottom_pane_widget = QtGui.QWidget()
        bottom_layout = QtGui.QHBoxLayout()
        bottom_layout.setSpacing(0)
        bottom_layout.setContentsMargins(5, 5, 5, 5)  # left top right bottom
        bottom_pane_widget.setLayout(bottom_layout)
        self.central_splitter.addWidget(bottom_pane_widget)

        group_box = QtGui.QGroupBox("Details")
        bottom_layout.addWidget(group_box)

        group_layout = QtGui.QHBoxLayout()
        group_layout.setContentsMargins(2, 2, 2, 2)  # left top right bottom
        group_box.setLayout(group_layout)

        # Radio buttons
        radio_widget = QtGui.QWidget()
        radio_layout = QtGui.QVBoxLayout()
        radio_layout.setContentsMargins(0, 0, 0, 0)  # left top right bottom
        radio_widget.setLayout(radio_layout)

        self.button_group = QtGui.QButtonGroup(self)
        for button_id, attr_detail in enumerate(self._attr_details):
            radio_button = QtGui.QRadioButton(attr_detail.name)
            radio_layout.addWidget(radio_button)
            self.button_group.addButton(radio_button, button_id)

        self.button_group.buttonClicked[int].connect(
            self._change_details_field)
        self.button_group.button(0).setChecked(True)

        radio_layout.addStretch(1)
        group_layout.addWidget(radio_widget)

        # Editor widget
        font = QtGui.QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        #font.setPointSize(14)

        self.editor = QtGui.QPlainTextEdit()
        self.editor.setReadOnly(True)
        self.editor.setFont(font)
        group_layout.addWidget(self.editor)

        # Splitter parameters
        self.central_splitter.setCollapsible(0, False)
        self.central_splitter.setCollapsible(1, True)
        self.central_splitter.setSizes([400, 200])
        self.central_splitter.setStretchFactor(0, 10)
        self.central_splitter.setStretchFactor(1, 0)