Example #1
0
 def initUI(self):
     self.setObjectName("NetworkSettings")
     self.resize(300, 330)
     self.setMinimumSize(QtCore.QSize(300, 330))
     self.setMaximumSize(QtCore.QSize(300, 330))
     self.setBaseSize(QtCore.QSize(300, 330))
     self.ipv = QtGui.QCheckBox(self)
     self.ipv.setGeometry(QtCore.QRect(20, 10, 97, 22))
     self.ipv.setObjectName("ipv")
     self.udp = QtGui.QCheckBox(self)
     self.udp.setGeometry(QtCore.QRect(150, 10, 97, 22))
     self.udp.setObjectName("udp")
     self.proxy = QtGui.QCheckBox(self)
     self.proxy.setGeometry(QtCore.QRect(20, 40, 97, 22))
     self.http = QtGui.QCheckBox(self)
     self.http.setGeometry(QtCore.QRect(20, 70, 97, 22))
     self.proxy.setObjectName("proxy")
     self.proxyip = LineEdit(self)
     self.proxyip.setGeometry(QtCore.QRect(40, 130, 231, 27))
     self.proxyip.setObjectName("proxyip")
     self.proxyport = LineEdit(self)
     self.proxyport.setGeometry(QtCore.QRect(40, 190, 231, 27))
     self.proxyport.setObjectName("proxyport")
     self.label = QtGui.QLabel(self)
     self.label.setGeometry(QtCore.QRect(40, 100, 66, 17))
     self.label_2 = QtGui.QLabel(self)
     self.label_2.setGeometry(QtCore.QRect(40, 165, 66, 17))
     self.reconnect = QtGui.QPushButton(self)
     self.reconnect.setGeometry(QtCore.QRect(40, 230, 231, 30))
     self.reconnect.clicked.connect(self.restart_core)
     settings = Settings.get_instance()
     self.ipv.setChecked(settings['ipv6_enabled'])
     self.udp.setChecked(settings['udp_enabled'])
     self.proxy.setChecked(settings['proxy_type'])
     self.proxyip.setText(settings['proxy_host'])
     self.proxyport.setText(str(settings['proxy_port']))
     self.http.setChecked(settings['proxy_type'] == 1)
     self.warning = QtGui.QLabel(self)
     self.warning.setGeometry(QtCore.QRect(5, 270, 290, 60))
     self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
     self.retranslateUi()
     self.proxy.stateChanged.connect(lambda x: self.activate())
     self.activate()
     QtCore.QMetaObject.connectSlotsByName(self)
Example #2
0
 def initUI(self):
     self.setMinimumSize(QtCore.QSize(700, 200))
     self.setMaximumSize(QtCore.QSize(700, 200))
     self.password = LineEdit(self)
     self.password.setGeometry(QtCore.QRect(40, 10, 300, 30))
     self.password.setEchoMode(QtWidgets.QLineEdit.Password)
     self.confirm_password = LineEdit(self)
     self.confirm_password.setGeometry(QtCore.QRect(40, 50, 300, 30))
     self.confirm_password.setEchoMode(QtWidgets.QLineEdit.Password)
     self.set_password = QtWidgets.QPushButton(self)
     self.set_password.setGeometry(QtCore.QRect(40, 100, 300, 30))
     self.set_password.clicked.connect(self.new_password)
     self.not_match = QtWidgets.QLabel(self)
     self.not_match.setGeometry(QtCore.QRect(350, 50, 300, 30))
     self.not_match.setVisible(False)
     self.not_match.setStyleSheet('QLabel { color: #BC1C1C; }')
     self.warning = QtWidgets.QLabel(self)
     self.warning.setGeometry(QtCore.QRect(40, 160, 500, 30))
     self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
    def __init__(self, messages, width, *args):
        super().__init__(*args)
        self.setMaximumSize(width, 40)
        self.setMinimumSize(width, 40)
        self._messages = messages

        self.search_text = LineEdit(self)
        self.search_text.setGeometry(0, 0, width - 160, 40)

        self.search_button = ClickableLabel(self)
        self.search_button.setGeometry(width - 160, 0, 40, 40)
        pixmap = QtGui.QPixmap()
        pixmap.load(util.curr_directory() + '/images/search.png')
        self.search_button.setScaledContents(False)
        self.search_button.setAlignment(QtCore.Qt.AlignCenter)
        self.search_button.setPixmap(pixmap)
        self.connect(self.search_button, QtCore.SIGNAL('clicked()'),
                     self.search)

        font = QtGui.QFont()
        font.setPointSize(32)
        font.setBold(True)

        self.prev_button = QtGui.QPushButton(self)
        self.prev_button.setGeometry(width - 120, 0, 40, 40)
        self.prev_button.clicked.connect(self.prev)
        self.prev_button.setText('\u25B2')

        self.next_button = QtGui.QPushButton(self)
        self.next_button.setGeometry(width - 80, 0, 40, 40)
        self.next_button.clicked.connect(self.next)
        self.next_button.setText('\u25BC')

        self.close_button = QtGui.QPushButton(self)
        self.close_button.setGeometry(width - 40, 0, 40, 40)
        self.close_button.clicked.connect(self.close)
        self.close_button.setText('×')
        self.close_button.setFont(font)

        font.setPointSize(18)
        self.next_button.setFont(font)
        self.prev_button.setFont(font)

        self.retranslateUi()
Example #4
0
    def setup_left_center_menu(self, Form):
        Form.resize(270, 25)
        self.search_label = QtGui.QLabel(Form)
        self.search_label.setGeometry(QtCore.QRect(3, 2, 20, 20))
        pixmap = QtGui.QPixmap()
        pixmap.load(curr_directory() + '/images/search.png')
        self.search_label.setScaledContents(False)
        self.search_label.setPixmap(pixmap)

        self.contact_name = LineEdit(Form)
        self.contact_name.setGeometry(QtCore.QRect(0, 0, 150, 25))
        self.contact_name.setObjectName("contact_name")
        self.contact_name.textChanged.connect(self.filtering)

        self.online_contacts = QtGui.QComboBox(Form)
        self.online_contacts.setGeometry(QtCore.QRect(150, 0, 120, 25))
        self.online_contacts.activated[int].connect(lambda x: self.filtering())
        self.search_label.raise_()

        QtCore.QMetaObject.connectSlotsByName(Form)
Example #5
0
 def initUI(self, tox_id):
     self.setObjectName('AddContact')
     self.resize(568, 306)
     self.sendRequestButton = QtGui.QPushButton(self)
     self.sendRequestButton.setGeometry(QtCore.QRect(50, 270, 471, 31))
     self.sendRequestButton.setMinimumSize(QtCore.QSize(0, 0))
     self.sendRequestButton.setBaseSize(QtCore.QSize(0, 0))
     self.sendRequestButton.setObjectName("sendRequestButton")
     self.sendRequestButton.clicked.connect(self.add_friend)
     self.tox_id = LineEdit(self)
     self.tox_id.setGeometry(QtCore.QRect(50, 40, 471, 27))
     self.tox_id.setObjectName("lineEdit")
     self.tox_id.setText(tox_id)
     self.label = QtGui.QLabel(self)
     self.label.setGeometry(QtCore.QRect(50, 10, 80, 20))
     self.error_label = DataLabel(self)
     self.error_label.setGeometry(QtCore.QRect(120, 10, 420, 20))
     font = QtGui.QFont()
     font.setPointSize(10)
     font.setWeight(30)
     self.error_label.setFont(font)
     self.error_label.setStyleSheet("QLabel { color: #BC1C1C; }")
     self.label.setObjectName("label")
     self.message_edit = QtGui.QTextEdit(self)
     self.message_edit.setGeometry(QtCore.QRect(50, 110, 471, 151))
     self.message_edit.setObjectName("textEdit")
     self.message = QtGui.QLabel(self)
     self.message.setGeometry(QtCore.QRect(50, 70, 101, 31))
     self.message.setFont(font)
     self.message.setObjectName("label_2")
     self.retranslateUi()
     self.message_edit.setText('Hello! Add me to your contact list please')
     font = QtGui.QFont()
     font.setPointSize(12)
     font.setBold(True)
     self.label.setFont(font)
     self.message.setFont(font)
     QtCore.QMetaObject.connectSlotsByName(self)
Example #6
0
    def initUI(self):
        self.setObjectName("ProfileSettingsForm")
        self.setMinimumSize(QtCore.QSize(700, 600))
        self.setMaximumSize(QtCore.QSize(700, 600))
        self.nick = LineEdit(self)
        self.nick.setGeometry(QtCore.QRect(30, 60, 350, 27))
        profile = Profile.get_instance()
        self.nick.setText(profile.name)
        self.status = QtGui.QComboBox(self)
        self.status.setGeometry(QtCore.QRect(400, 60, 200, 27))
        self.status_message = LineEdit(self)
        self.status_message.setGeometry(QtCore.QRect(30, 130, 350, 27))
        self.status_message.setText(profile.status_message)
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(40, 30, 91, 25))
        font = QtGui.QFont()
        font.setPointSize(18)
        font.setWeight(75)
        font.setBold(True)
        self.label.setFont(font)
        self.label_2 = QtGui.QLabel(self)
        self.label_2.setGeometry(QtCore.QRect(40, 100, 100, 25))
        self.label_2.setFont(font)
        self.label_3 = QtGui.QLabel(self)
        self.label_3.setGeometry(QtCore.QRect(40, 180, 100, 25))
        self.label_3.setFont(font)
        self.tox_id = QtGui.QLabel(self)
        self.tox_id.setGeometry(QtCore.QRect(15, 210, 685, 21))
        font.setPointSize(10)
        self.tox_id.setFont(font)
        s = profile.tox_id
        self.tox_id.setText(s)
        self.copyId = QtGui.QPushButton(self)
        self.copyId.setGeometry(QtCore.QRect(40, 250, 180, 30))
        self.copyId.clicked.connect(self.copy)
        self.export = QtGui.QPushButton(self)
        self.export.setGeometry(QtCore.QRect(230, 250, 180, 30))
        self.export.clicked.connect(self.export_profile)
        self.new_nospam = QtGui.QPushButton(self)
        self.new_nospam.setGeometry(QtCore.QRect(420, 250, 180, 30))
        self.new_nospam.clicked.connect(self.new_no_spam)

        self.new_avatar = QtGui.QPushButton(self)
        self.new_avatar.setGeometry(QtCore.QRect(40, 300, 180, 30))
        self.delete_avatar = QtGui.QPushButton(self)
        self.delete_avatar.setGeometry(QtCore.QRect(230, 300, 180, 30))
        self.delete_avatar.clicked.connect(self.reset_avatar)
        self.new_avatar.clicked.connect(self.set_avatar)
        self.profile_pass = QtGui.QLabel(self)
        self.profile_pass.setGeometry(QtCore.QRect(40, 340, 300, 30))
        font.setPointSize(18)
        self.profile_pass.setFont(font)
        self.password = LineEdit(self)
        self.password.setGeometry(QtCore.QRect(40, 380, 300, 30))
        self.password.setEchoMode(QtGui.QLineEdit.EchoMode.Password)
        self.leave_blank = QtGui.QLabel(self)
        self.leave_blank.setGeometry(QtCore.QRect(350, 380, 300, 30))
        self.confirm_password = LineEdit(self)
        self.confirm_password.setGeometry(QtCore.QRect(40, 420, 300, 30))
        self.confirm_password.setEchoMode(QtGui.QLineEdit.EchoMode.Password)
        self.set_password = QtGui.QPushButton(self)
        self.set_password.setGeometry(QtCore.QRect(40, 470, 300, 30))
        self.set_password.clicked.connect(self.new_password)
        self.not_match = QtGui.QLabel(self)
        self.not_match.setGeometry(QtCore.QRect(350, 420, 300, 30))
        self.not_match.setVisible(False)
        self.not_match.setStyleSheet('QLabel { color: #BC1C1C; }')
        self.warning = QtGui.QLabel(self)
        self.warning.setGeometry(QtCore.QRect(40, 510, 500, 30))
        self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
        self.default = QtGui.QPushButton(self)
        self.default.setGeometry(QtCore.QRect(40, 550, 620, 30))
        path, name = Settings.get_auto_profile()
        self.auto = path + name == ProfileHelper.get_path(
        ) + Settings.get_instance().name
        self.default.clicked.connect(self.auto_profile)
        self.retranslateUi()
        if profile.status is not None:
            self.status.setCurrentIndex(profile.status)
        else:
            self.status.setVisible(False)
        QtCore.QMetaObject.connectSlotsByName(self)
Example #7
0
    def initUI(self):
        self.setWindowTitle(self.login_title)
        self.setFixedSize(self.lgoin_width, self.login_height)
        self.setWindowIcon(Icon("mztj"))
        self.setStyleSheet(self.login_style)
        self.setWindowFlags(Qt.FramelessWindowHint)  #窗口模式,去掉标题栏

        # 给窗体再加一个widget控件,对widget设置背景图片
        self.widget = QWidget(self)
        self.widget.setFixedSize(self.lgoin_width, self.login_height)
        palette = QPalette()
        palette.setBrush(self.backgroundRole(), QBrush(QPixmap(self.login_bg)))
        self.widget.setPalette(palette)
        self.widget.setAutoFillBackground(True)

        lt_main = QVBoxLayout(self)
        lt_main.setAlignment(Qt.AlignCenter)
        layout = QFormLayout()
        layout.setLabelAlignment(Qt.AlignRight)
        layout.setFormAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        # 用户ID
        self.lb_user_id = LineEdit(None, "", LineEdit.SUCCESS_STYLE)
        regx = QRegExp("[a-zA-Z0-9]+$")
        validator = QRegExpValidator(regx, self.lb_user_id)
        self.lb_user_id.setValidator(validator)  #根据正则做限制,只能输入数字
        self.lb_user_id.setMaximumWidth(200)
        # self.lb_user_id.setFocusPolicy(Qt.ClickFocus)
        # 用户姓名
        self.lb_user_name = LineEdit(None, "", LineEdit.SUCCESS_STYLE)
        self.lb_user_name.setDisabled(True)
        self.lb_user_name.setMaximumWidth(200)
        # 用户密码
        self.lb_user_pd = LineEdit(None, "", LineEdit.SUCCESS_STYLE)
        self.lb_user_pd.setMaximumWidth(200)
        self.lb_user_pd.setEchoMode(QLineEdit.Password)
        # 是否自动填充
        self.is_rem = QCheckBox("记住最近登录")
        self.is_rem.setStyleSheet(self.login_font)
        # 进入主界面还是接口界面
        self.is_equip = QCheckBox("进入设备接口")
        self.is_equip.setStyleSheet(self.login_font)

        # 版本号
        self.lb_version = QLabel(self)
        self.lb_version.setText('当前版本:%s' %
                                str(gol.get_value('system_version', '读取失败')))
        self.lb_version.setStyleSheet(self.login_font)
        self.lb_version.setGeometry(QRect(400, 360, 100, 30))

        if not gol.get_value('login_auto_record', 0):
            self.is_rem.setChecked(False)
        else:
            self.is_rem.setChecked(True)
            # 自动填充最近登录信息
            self.lb_user_id.setText(str(gol.get_value('login_user_id',
                                                      'BSSA')))
            self.lb_user_name.setText(gol.get_value('login_user_name', '管理员'))

        if not gol.get_value('system_is_equip', 0):
            self.is_equip.setChecked(False)
        else:
            self.is_equip.setChecked(True)

        ######################添加布局##########################################
        layout0 = QHBoxLayout()
        layout0.addWidget(self.is_rem)
        layout0.addWidget(self.is_equip)
        layout0.addStretch()
        login_user = "******"
        layout.addWidget(QLabel(""))
        layout.addRow(QLabel("账户:"), self.lb_user_id)
        layout.addRow(login_user, self.lb_user_name)
        layout.addRow(QLabel("密码:"), self.lb_user_pd)
        layout.addRow(QLabel(""), layout0)
        layout.setHorizontalSpacing(10)
        layout.setVerticalSpacing(10)

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.addButton("登录", QDialogButtonBox.YesRole)
        self.buttonBox.addButton("取消", QDialogButtonBox.NoRole)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.buttons()[0].setEnabled(False)
        # 失去焦点
        # self.buttonBox.buttons()[0].setFocusPolicy(Qt.ClickFocus)
        # self.buttonBox.buttons()[1].setFocusPolicy(Qt.NoFocus)

        # 对登录进行限制
        if self.lb_user_name.text():
            self.buttonBox.buttons()[0].setEnabled(True)
        else:
            self.buttonBox.buttons()[0].setEnabled(False)

        self.lb_user_id.textEdited.connect(self.set_empty)
        self.lb_user_id.editingFinished.connect(self.user_get)
        self.is_equip.stateChanged.connect(self.on_equip_change)
        self.buttonBox.accepted.connect(self.login)
        self.buttonBox.rejected.connect(self.reject)

        lt_main.addSpacing(30)
        lt_main.addLayout(layout)
        lt_main.addSpacing(20)
        lt_main.addWidget(self.buttonBox)
        self.setLayout(lt_main)