main.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:recordium 作者: facundobatista 项目源码 文件源码
def __init__(self):
        super().__init__()
        self.setWindowTitle("Configuration")

        main_layout = QtWidgets.QVBoxLayout()
        if not config.BOT_AUTH_TOKEN:
            main_layout.addWidget(QtWidgets.QLabel(
                "Please configure Recordium to be able to start fetching messages\n"
                "See instructions on README.rst"), 0)
            hline = QtWidgets.QFrame()
            hline.setFrameShape(QtWidgets.QFrame.HLine)
            hline.setFrameShadow(QtWidgets.QFrame.Sunken)
            main_layout.addWidget(hline)

        self.grid = grid = QtWidgets.QGridLayout()
        grid.addWidget(QtWidgets.QLabel("Telegram bot auth token:"), 0, 0)  # row 0, col 0
        prev = config.BOT_AUTH_TOKEN
        self.entry_auth_token = QtWidgets.QLineEdit(prev)
        grid.addWidget(self.entry_auth_token, 0, 1, 1, 2)  # row 0, cols 1 and 2

        grid.addWidget(QtWidgets.QLabel("Polling time (in seconds, min=1):"), 1, 0)  # row 1, col 0
        prev = config.POLLING_TIME
        self.entry_polling_time = QtWidgets.QSpinBox()
        self.entry_polling_time.setValue(prev)
        self.entry_polling_time.setMinimum(1)
        grid.addWidget(self.entry_polling_time, 1, 1, 1, 2)  # row 1, cols 1 and 2

        grid.addWidget(QtWidgets.QLabel("Allowed user id to send messages:"), 2, 0)  # row 2, col 0
        self._user_reset_button = QtWidgets.QPushButton("Reset")
        self._user_reset_button.clicked.connect(self._user_reset)
        grid.addWidget(self._user_reset_button, 2, 2)  # row 2, col 2
        user_config = config.USER_ALLOWED
        if user_config is None:
            user_config = self._msg_user_not_set
            self._user_reset_button.setEnabled(False)
        else:
            user_config = str(user_config)
        self._user_reset_label = QtWidgets.QLabel(user_config)
        grid.addWidget(self._user_reset_label, 2, 1)  # row 2, col 1

        main_layout.addLayout(grid, 0)
        main_layout.addStretch(1)

        self.setLayout(main_layout)
        self.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号