Пример #1
0
 def _initialize_widget(self) -> None:
     self.widget = QStackedWidget()
     self.widget.setMaximumSize(app_size["Max"]["Width"],
                                app_size["Max"]["Height"])
     self.widget.setMinimumSize(app_size["Min"]["Width"],
                                app_size["Min"]["Height"])
Пример #2
0
 def __init__(self):
     QWidget.__init__(self, flags=Qt.Widget)
     self.stk_w = QStackedWidget(self)
     self.init_widget()
    def __init__(self, config_dir):
        super(RSSReaderWidget, self).__init__()

        self.feed_file_path = os.path.join(config_dir, "rss-reader",
                                           "feeds.json")

        self.feed_area = QWidget()
        self.feed_list = QListWidget()
        self.feed_list.setStyleSheet(
            """QListView {background: #4D5250; show-decoration-selected: 1; selection-background-color: #464646;}"""
        )
        panel_layout = QVBoxLayout()
        panel_layout.setSpacing(0)
        panel_layout.setContentsMargins(0, 0, 0, 0)
        panel_layout.addWidget(self.feed_list)
        self.feed_area.setLayout(panel_layout)

        self.article_area = QWidget()
        self.article_list = QListWidget()
        self.article_list.setStyleSheet(
            """QListView {background: #FFF; show-decoration-selected: 1; selection-background-color: #EEE;}"""
        )
        self.article_list.verticalScrollBar().setStyleSheet(
            "QScrollBar {width:0px;}")
        article_layout = QVBoxLayout()
        article_layout.setSpacing(0)
        article_layout.setContentsMargins(0, 0, 0, 0)

        self.browser = BrowserView(config_dir)

        article_layout.addWidget(self.article_list)
        article_layout.addWidget(self.browser)

        article_layout.setStretchFactor(self.article_list, 1)
        article_layout.setStretchFactor(self.browser, 3)

        self.article_area.setLayout(article_layout)

        self.welcome_page = QWidget()
        self.welcome_page_box = QVBoxLayout()
        self.welcome_page_box.setSpacing(10)
        self.welcome_page_box.setContentsMargins(0, 0, 0, 0)

        welcome_title_label = QLabel("Welcome to EAF RSS Reader!")
        welcome_title_label.setFont(QFont('Arial', 24))
        welcome_title_label.setStyleSheet(
            "QLabel {color: white; font-weight: bold; margin: 20px;}")
        welcome_title_label.setAlignment(Qt.AlignHCenter)

        add_subscription_label = QLabel("Press 'a' to subscribe to a feed!")
        add_subscription_label.setFont(QFont('Arial', 20))
        add_subscription_label.setStyleSheet("QLabel {color: #grey;}")
        add_subscription_label.setAlignment(Qt.AlignHCenter)

        self.welcome_page_box.addStretch(1)
        self.welcome_page_box.addWidget(welcome_title_label)
        self.welcome_page_box.addWidget(add_subscription_label)
        self.welcome_page_box.addStretch(1)

        self.welcome_page.setLayout(self.welcome_page_box)

        self.right_area = QStackedWidget()
        self.right_area.addWidget(self.welcome_page)
        self.right_area.addWidget(self.article_area)

        if self.has_feed():
            self.right_area.setCurrentIndex(1)
        else:
            self.right_area.setCurrentIndex(0)

        hbox = QHBoxLayout()
        hbox.setSpacing(0)
        hbox.setContentsMargins(0, 0, 0, 0)

        hbox.addWidget(self.feed_area)
        hbox.addWidget(self.right_area)

        hbox.setStretchFactor(self.feed_area, 1)
        hbox.setStretchFactor(self.right_area, 3)

        self.setLayout(hbox)

        self.feed_list.itemActivated.connect(self.handle_feed)
        self.article_list.itemActivated.connect(self.handle_article)

        self.feed_object_dict = {}

        self.init_select_line = False

        self.fetch_feeds()
Пример #4
0
    def __init__(self, controls, parent=None, status=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle("puddletag settings")
        winsettings('settingswin', self)

        built_in = [
            (translate("Settings", 'General'),
             GeneralSettings(controls), controls),
            (translate("Settings", 'Confirmations'),
             confirmations.Settings(), None),
            (translate("Settings", 'Mappings'), TagMappings(), None),
            (translate("Settings", 'Playlist'), Playlist(), None),
            (translate("Settings", 'Colours'), ColorEdit(), status['table']),
            (translate("Settings", 'Genres'),
             genres.Genres(status=status), None),
            (translate("Settings", 'Tags'), Tags(status=status),
             status['table']),
            (translate("Settings", 'Plugins'), PluginConfig(), None),
            (translate("Settings", 'Shortcuts'),
             ActionEditorDialog(status['actions']), None), ]

        d = dict(enumerate(built_in))

        i = len(d)
        for control in controls:
            if hasattr(control, SETTINGSWIN):
                c = getattr(control, SETTINGSWIN)(status=status)
                d[i] = [c.title, c, control]
                i += 1
        for c in config_widgets:
            d[i] = [c.title, c(status=status), None]
            i += 1

        self._widgets = d

        self.listbox = SettingsList()
        self.model = ListModel(d)
        self.listbox.setModel(self.model)

        self.stack = QStackedWidget()
        self.stack.setFrameStyle(QFrame.StyledPanel)

        self.grid = QGridLayout()
        self.grid.addWidget(self.listbox)
        self.grid.addWidget(self.stack, 0, 1)
        self.grid.setColumnStretch(1, 2)
        self.setLayout(self.grid)

        self.listbox.selectionChangedSignal.connect(self.showOption)

        selection = QItemSelection()
        self.selectionModel = QItemSelectionModel(self.model)
        index = self.model.index(0, 0)
        selection.select(index, index)
        self.listbox.setSelectionModel(self.selectionModel)
        self.selectionModel.select(selection, QItemSelectionModel.Select)

        self.okbuttons = OKCancel()
        self.okbuttons.okButton.setDefault(True)
        self.grid.addLayout(self.okbuttons, 1, 0, 1, 2)

        self.okbuttons.ok.connect(self.saveSettings)
        self.accepted.connect(self.saveSettings)
        self.okbuttons.cancel.connect(self.close)
Пример #5
0
    def initUI(self):
        self.setGeometry(450,100,1000,800)
        self.setWindowTitle('中医药数据特征选择分析平台')

        self.list_widget = QListWidget()
        self.item_list = ['平台首页','数据导入','特征选择','数据中心','算法中心','知识中心','反馈建议','关于我们']
        self.list_widget.addItems(self.item_list)
        item1 = QListWidgetItem()
        self.list_widget.addItem(item1)
        # quit = QLabel('退出')
        # quit.setPixmap(QPixmap('./image/退出.png'))

        # quit = QPushButton('退出')
        # quit.setMaximumSize(80, 50)
        # quit.setIcon(QIcon(QPixmap('./image/退出.png')))
        # quit.clicked.connect(self.close)

        # sizePolicy = QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
        # # print(quit.size())
        # quit.setSizePolicy(sizePolicy)
        # self.list_widget.setItemWidget(item1,quit)

        #设置item间隔
        self.list_widget.setSpacing(5)

        #创建各个功能子窗口
        self.interface_widget = IntefaceWindow()
        self.input_widget = IW.InputWindowDemo()
        self.select_feature_widget = SW.SelectionWindowdemo()
        # self.analyze_data_widget = QWidget()
        self.database_widget = DataCenterWindow.DataCenterWindow()
        self.algorithm_widget = QWidget()
        self.konwledge_widget = QWidget()
        self.contact_widget = ContactWindow.ConcatWindow()
        self.about_widget = AboutUSWindow.AboutUSWindowDemo()

        #将各个功能子窗口压入栈窗口
        self.stack_widget = QStackedWidget()
        self.stack_widget.addWidget(self.interface_widget)
        self.stack_widget.addWidget(self.input_widget)
        self.stack_widget.addWidget(self.select_feature_widget)
        # self.stack_widget.addWidget(self.analyze_data_widget)
        self.stack_widget.addWidget(self.database_widget)
        self.stack_widget.addWidget(self.algorithm_widget)
        self.stack_widget.addWidget(self.konwledge_widget)
        self.stack_widget.addWidget(self.contact_widget)
        self.stack_widget.addWidget(self.about_widget)

        #布局
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.list_widget)
        hlayout.addWidget(self.stack_widget)
        #等比例划分布局
        hlayout.setStretch(0,1)
        hlayout.setStretch(1,5)
        self.setLayout(hlayout)

        #美化:
        #去边框
        self.list_widget.setFrameShape(False)
        #icon
        self.setWindowIcon(QIcon('../image/分析.png'))
        # 背景图片
        # palette = QPalette()
        # pix = QPixmap(r'./')
        # pix.scaled(self.width(),self.height())
        # palette.setBrush(QPalette.Background,QBrush(pix))
        # self.setPalette(palette)

        #关联单击信号
        self.list_widget.currentRowChanged.connect(self.onClickedListWidget)
Пример #6
0
    def __init__(self):
        super(HRMainWindow, self).__init__()
        self.setWindowTitle("瑞达期货研究院持仓研究系统2020.01")
        self.setWindowIcon(QIcon('static/Icon.png'))
        main_menu = self.menuBar()
        """主菜单"""
        # 功能选择
        active_menu = main_menu.addMenu('功能选择')
        # 系统设置
        system_menu = main_menu.addMenu('系统设置')
        # 导出数据
        export_data = main_menu.addMenu('导出数据')

        """子菜单"""
        # 价格-净持率
        price_holding = QAction("价格 - 净持率", self)
        price_holding.setStatusTip('生成指定时间价格和净持率的走势图')
        price_holding.triggered.connect(self.price_holding)
        # 品种-权重
        variety_percent = QAction("品种权重指数", self)
        variety_percent.setStatusTip('品种的在存续合约持仓权重生成指数')
        variety_percent.triggered.connect(self.variety_percent)
        # 主力合约
        main_contract = QAction("主力合约指数", self)
        main_contract.setStatusTip('最大持仓品种的历史价格指数')
        main_contract.triggered.connect(self.main_contract)
        # 一键更新子菜单
        one_key_update = QAction('一键更新系统数据', self)
        one_key_update.setStatusTip('一键更新四大交易所的所有数据')
        one_key_update.triggered.connect(self.one_key_update)
        # 指定更新子菜单
        point_key_update = QAction("指定更新系统数据", self)
        point_key_update.setStatusTip("选择交易所更新数据")
        point_key_update.triggered.connect(self.point_key_update)
        # 添加品种子菜单
        add_variety = QAction("指定添加新的品种", self)
        add_variety.setStatusTip("选择交易所添加新品种")
        add_variety.triggered.connect(self.add_variety)
        # 查询当前最新数据时间
        view_lasted = QAction("查看最新数据时间", self)
        view_lasted.setStatusTip("查看当前系统中数据的最新时间")
        view_lasted.triggered.connect(self.view_lasted)
        # 更新品种权重价格指数菜单
        variety_price_btn = QAction("更新品种价格指数", self)
        variety_price_btn.setStatusTip("更新品种价格指数数据库")
        variety_price_btn.triggered.connect(self.update_price_index)

        # 导出Excel
        export_excel = QAction('导出Excel', self)
        export_excel.setStatusTip("导出数据到Excel文件")
        export_excel.triggered.connect(self.export_excel)
        # 导出表格
        self.export_table = QAction('导出数据表', self)
        self.export_table.setEnabled(False)
        self.export_table.setStatusTip("导出季节图表数据到Excel文件")
        self.export_table.triggered.connect(self.export_table_data)
        """将子菜单添加到父菜单"""
        # 功能菜单
        active_menu.addAction(price_holding)
        active_menu.addAction(variety_percent)
        active_menu.addAction(main_contract)
        # 系统菜单
        system_menu.addAction(one_key_update)
        system_menu.addAction(point_key_update)
        system_menu.addAction(add_variety)
        system_menu.addAction(view_lasted)
        system_menu.addAction(variety_price_btn)
        # 导出数据菜单
        export_data.addAction(export_excel)
        export_data.addAction(self.export_table)

        # 中心提示显示-首页展示
        attention_label = QLabel("请点击左上角'功能选择'菜单\n选择您要的功能选项")
        attention_label.setAlignment(Qt.AlignCenter)
        attention_label.setFont(QFont("SimHei", 11, QFont.Bold))
        pe = QPalette()
        pe.setColor(QPalette.WindowText, Qt.red)
        attention_label.setPalette(pe)
        """中心窗口堆栈"""
        self.window_stack = QStackedWidget()
        self.net_holding_window = NetHoldingWindow(title='品种净持率-价格走势')
        self.variety_price_window = VarietyPriceWindow(title='品种权重指数')
        self.main_contract_window = MainContractWindow(title='主力合约历史价格指数')
        self.window_stack.addWidget(attention_label)
        self.window_stack.addWidget(self.net_holding_window)
        self.window_stack.addWidget(self.variety_price_window)
        self.window_stack.addWidget(self.main_contract_window)
        self.setCentralWidget(self.window_stack)

        """初始化系统隐藏窗口,用于执行系统相关操作"""
        self.sys_window = SysWindow(title="系统窗口")
        """状态栏"""
        self.status_bar = QStatusBar()  # 状态显示栏
        # 显示当前功能
        self.window_label = QLabel()
        # 设置显示格式
        self.window_label.setFont(QFont("SimHei", 10))
        pe = QPalette()
        pe.setColor(QPalette.WindowText, Qt.gray)
        self.window_label.setPalette(pe)
        self.process_label = QLabel("当前进度:")
        self.process_bar = QProgressBar()  # 进度条
        self.process_bar.setMaximumWidth(150)
        self.process_bar.setMaximumHeight(15)
        self.status_bar.addPermanentWidget(self.process_label)
        self.status_bar.addPermanentWidget(self.process_bar)
        self.status_bar.addPermanentWidget(self.window_label)
        self.setStatusBar(self.status_bar)  # 状态栏加入主窗口
        """定义主窗口大小"""
        self.resize(1200, 680)
Пример #7
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        self.menu_File = QtWidgets.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        
        MainWindow.setMenuBar(self.menubar)

        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)        
        
        self.action_Exit = QtWidgets.QAction(MainWindow)
        self.action_Exit.setObjectName("action_Exit")
        self.action_Exit.setStatusTip('Exit')
        self.actionOpenFile = QtWidgets.QAction(MainWindow)
        self.actionOpenFile.setObjectName("actionOpenFile")
        self.actionOpenFile.setStatusTip('Open new File')
        self.actionOpenDir = QtWidgets.QAction(MainWindow)
        self.actionOpenDir.setObjectName("actionOpenDir")
        self.actionOpenDir.setStatusTip('Open Directory')
        self.menu_File.addAction(self.actionOpenFile)
        self.menu_File.addAction(self.actionOpenDir)
        self.menu_File.addSeparator()
        self.menu_File.addAction(self.action_Exit)
        self.menubar.addAction(self.menu_File.menuAction())


        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.ViewMode.IconMode)
        self.contentsWidget.setIconSize(QSize(140,140))					# add icon 2/6
        self.contentsWidget.setMovement(QListView.Movement.Static)		# add icon
        # self.contentsWidget.insertItem(0, 'Linked/Unlinked Bags')		# add icon
        # self.contentsWidget.insertItem(1, 'Simulation Tools')			# add icon
        self.contentsWidget.setMinimumWidth(160)
        self.contentsWidget.setMaximumWidth(160)
        self.contentsWidget.setSpacing(6)								# add icon
        # self.contentsWidget.setMaximumWidth(480)

        self.createIcons()				# add icon

        self.stack1 = QWidget()
        self.stack2 = QWidget()

        self.stack1UI()
        self.stack2UI()

        self.st = QStackedWidget(self.centralwidget)
        self.st.addWidget(self.stack1)
        self.st.addWidget(self.stack2)
        self.st.setMinimumWidth(640)
        self.st.setMinimumHeight(480)

        # print(self.size().width())  # tried to get mainwindow size

        hbox = QHBoxLayout(self.centralwidget)
        hbox.addWidget(self.contentsWidget)
        hbox.addWidget(self.st)
        # hbox.setStretch(1, 100)					# need to check if this line matters 2/12 10:35

        self.centralwidget.setLayout(hbox)
        # self.statusbar = QMainWindow.statusBar(MainWindow)


        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        
        self.contentsWidget.currentRowChanged.connect(self.display)
        self.actionOpenFile.triggered.connect(self.openFile)
        self.actionOpenDir.triggered.connect(self.openDir)
        self.action_Exit.triggered.connect(self.exit)
Пример #8
0
    def __init__(self, parent=None):
        """Dialogs that allows users to load music libraries.

        A list of libraries is listed in a ListWidget on the left with the library module's InitWidget shown on the right.

        First all libraries stored in puddlestuff.libraries are loaded.
        Then puddlestuff.musiclib.extralibs is checked for an extra libraries.
        They should already be loaded.

        

        Useful methods:
            loadLib()->Loads the currently selected library.
            loadLibConfig()

        Libraries are module which should contain the following:
            name->The name of the library.
            InitWidget class->Used to allow the use to set options required for loading the library.
        """
        QDialog.__init__(self, parent)
        self.listbox = QListWidget()
        self.setWindowTitle(translate('MusicLib', 'Import Music Library'))
        winsettings('importmusiclib', self)

        self.libattrs = []
        for libname in libraries.__all__:
            try:
                lib = __import__('puddlestuff.libraries.%s' % libname,
                                 fromlist=['puddlestuff', 'libraries'])
                if not hasattr(lib, 'InitWidget'):
                    raise Exception(translate('MusicLib', 'Invalid library'))
            except Exception as detail:
                msg = translate('MusicLib', 'Error loading %1: %2\n')
                msg = msg.arg(libname).arg(str(detail))
                sys.stderr.write(msg)
                continue

            try:
                name = lib.name
            except AttributeError:
                name = translate('MusicLib', 'Anonymous Library')

            try:
                desc = lib.description
            except AttributeError:
                desc = translate('MusicLib', 'Description was left out.')

            try:
                author = lib.author
            except AttributeError:
                author = translate('MusicLib', 'Anonymous author.')

            self.libattrs.append({
                'name': name,
                'desc': desc,
                'author': author,
                'module': lib
            })

        self.libattrs.extend(extralibs)

        if not self.libattrs:
            raise MusicLibError(0, errors[0])

        self.listbox.addItems([z['name'] for z in self.libattrs])
        self.stackwidgets = [z['module'].InitWidget() for z in self.libattrs]
        self.listbox.currentRowChanged.connect(self.changeWidget)

        okcancel = OKCancel()
        okcancel.ok.connect(self.loadLib)
        okcancel.cancel.connect(self.close)

        self.stack = QStackedWidget()
        self.stack.setFrameStyle(QFrame.Box)
        list(map(self.stack.addWidget, self.stackwidgets))

        hbox = QHBoxLayout()
        hbox.addWidget(self.listbox, 0)
        hbox.addWidget(self.stack, 1)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(okcancel)

        self.setLayout(vbox)
Пример #9
0
    def __init__(self, parent: MainWindow):
        super().__init__()
        self.title = "atomicswap - atomicswap-qt"
        self.left = 0
        self.top = 0
        self.width = 600
        self.height = 400
        self.send_coin_name = "Bitcoin"
        self.receive_coin_name = "Litecoin"
        self.parent = parent
        self.send_coind = None
        self.receive_coind = None
        self.initiate_flag = False
        self.secret = b""
        self.secret_hash = b""
        self.my_address = ""
        self.send_contract_tuple = None
        self.receive_tx = None
        self.main_window = QWidget(self)
        self.main_vbox = QVBoxLayout(self.main_window)
        self.main_widget = QStackedWidget()
        self.button_widget = QStackedWidget()

        # start window
        self.start = QWidget(self.main_widget)
        self.start_vbox = QVBoxLayout(self.start)
        self.atomic_label = QLabel("<h1>Welcome to atomicswap-qt!</h1>", self)
        self.atomic_label.setAlignment(Qt.AlignCenter)
        self.start_vbox.addWidget(self.atomic_label)
        self.coins_hbox = QHBoxLayout()
        self.send_coin_label = QLabel(self)
        self.send_coin_label.setPixmap(
            QPixmap(
                resource_path("coins",
                              self.send_coin_name.lower() + ".png")).scaled(
                                  128, 128))
        self.send_coin_label.setAlignment(Qt.AlignCenter)
        self.send_label = QLabel("Send currency", self)
        self.send_label.setAlignment(Qt.AlignCenter)
        self.send_coin_combo = QComboBox(self)
        self.send_coin_combo.addItems(coin_list)
        self.send_coin_combo.activated[str].connect(self.on_send_coin)
        self.send_coin_index = coin_list.index(self.send_coin_name)
        self.send_coin_combo.setCurrentIndex(self.send_coin_index)
        self.send_coin_vbox = QVBoxLayout()
        self.send_coin_vbox.addWidget(self.send_coin_label)
        self.send_coin_vbox.addWidget(self.send_label)
        self.send_coin_vbox.addWidget(self.send_coin_combo)
        self.receive_coin_label = QLabel(self)
        self.receive_coin_label.setPixmap(
            QPixmap(
                resource_path("coins",
                              self.receive_coin_name.lower() + ".png")).scaled(
                                  128, 128))
        self.receive_coin_label.setAlignment(Qt.AlignCenter)
        self.receive_label = QLabel("Receive currency", self)
        self.receive_label.setAlignment(Qt.AlignCenter)
        self.receive_coin_combo = QComboBox(self)
        self.receive_coin_combo.addItems(coin_list)
        self.receive_coin_combo.activated[str].connect(self.on_receive_coin)
        self.receive_coin_index = coin_list.index(self.receive_coin_name)
        self.receive_coin_combo.setCurrentIndex(self.receive_coin_index)
        self.receive_coin_vbox = QVBoxLayout()
        self.receive_coin_vbox.addWidget(self.receive_coin_label)
        self.receive_coin_vbox.addWidget(self.receive_label)
        self.receive_coin_vbox.addWidget(self.receive_coin_combo)
        self.swap_label = QLabel(self)
        self.swap_label.setPixmap(
            QPixmap(resource_path("qt", "icons", "icons8-swap.png")))
        self.swap_label.setAlignment(Qt.AlignCenter)
        self.swap_vbox = QVBoxLayout()
        self.swap_vbox.addStretch(1)
        self.swap_vbox.addWidget(self.swap_label)
        self.swap_vbox.addStretch(2)
        self.coins_hbox.addLayout(self.send_coin_vbox)
        self.coins_hbox.addLayout(self.swap_vbox)
        self.coins_hbox.addLayout(self.receive_coin_vbox)
        self.start_vbox.addLayout(self.coins_hbox)
        self.main_widget.addWidget(self.start)

        # start buttons
        self.start_button_widget = QWidget()
        self.quit_button = QPushButton("Quit", self)
        self.start_next_button = QPushButton("Next", self)
        self.start_next_button.setDefault(True)
        self.quit_button.clicked.connect(self.hide)
        self.start_next_button.clicked.connect(self.next_page)
        self.start_button_hbox = QHBoxLayout(self.start_button_widget)
        self.start_button_hbox.addStretch(1)
        self.start_button_hbox.addWidget(self.quit_button)
        self.start_button_hbox.addWidget(self.start_next_button)
        self.button_widget.addWidget(self.start_button_widget)

        # buttons
        self.normal_button_widget = QWidget()
        self.back_button = QPushButton("Back", self)
        self.next_button_1 = QPushButton("Next", self)
        self.button_hbox = QHBoxLayout(self.normal_button_widget)
        self.button_hbox.addStretch(1)
        self.button_hbox.addWidget(self.back_button)
        self.button_hbox.addWidget(self.next_button_1)
        self.next_button_1.setDisabled(True)
        self.back_button.clicked.connect(self.back_page)
        self.next_button_1.clicked.connect(self.next_page)
        self.button_widget.addWidget(self.normal_button_widget)

        # finish buttons
        self.finish_button_widget = QWidget()
        self.back_button_1 = QPushButton("Back", self)
        self.finish_button = QPushButton("Finish", self)
        self.finish_button_hbox = QHBoxLayout(self.finish_button_widget)
        self.finish_button_hbox.addStretch(1)
        self.finish_button_hbox.addWidget(self.back_button_1)
        self.finish_button_hbox.addWidget(self.finish_button)
        self.back_button_1.hide()
        self.back_button_1.clicked.connect(self.back_page)
        self.finish_button.clicked.connect(self.hide)
        self.button_widget.addWidget(self.finish_button_widget)

        # initiate and participate window
        self.ip = QWidget(self.main_widget)
        self.ip_v_box = QVBoxLayout(self.ip)
        self.ip_label = QLabel("Please select initiator or participator.")
        self.ip_bg = QButtonGroup()
        self.initiate_button = QRadioButton(
            "You are initiator. Send coin first.")
        self.participate_button = QRadioButton(
            "You are participator. Receive contract from initiator.")
        self.initiate_button.clicked.connect(self.initiate)
        self.participate_button.clicked.connect(self.participate)
        self.ip_widget = QStackedWidget()
        self.none_widget = QWidget()
        self.none_vbox = QVBoxLayout(self.none_widget)
        self.none_vbox.addStretch(1)
        self.ip_widget.addWidget(self.none_widget)
        self.initiate_widget = QWidget()
        self.initiate_vbox = QVBoxLayout(self.initiate_widget)
        self.i_label = QLabel()
        self.i_addr_label = QLabel()
        self.i_addr_box = QLineEdit(self)
        self.i_addr_box.textEdited.connect(self.ip_edited)
        self.i_amount_label = QLabel("Amount")
        self.i_amount_box = QLineEdit(self)
        self.i_amount_box.textEdited.connect(self.ip_edited)
        self.initiate_vbox.addWidget(self.i_label)
        self.initiate_vbox.addWidget(self.i_addr_label)
        self.initiate_vbox.addWidget(self.i_addr_box)
        self.initiate_vbox.addWidget(self.i_amount_label)
        self.initiate_vbox.addWidget(self.i_amount_box)
        self.initiate_vbox.addStretch(1)
        self.ip_widget.addWidget(self.initiate_widget)
        self.participate_widget = QWidget()
        self.participate_vbox = QVBoxLayout(self.participate_widget)
        self.address_hbox = QHBoxLayout()
        self.my_address_label = QLabel()
        self.address_copy_button = QPushButton("Copy")
        self.address_hbox.addWidget(self.my_address_label)
        self.address_hbox.addStretch(1)
        self.address_hbox.addWidget(self.address_copy_button)
        self.address_copy_button.clicked.connect(lambda: copy(self.my_address))
        self.my_address_box = QLineEdit(self)
        self.my_address_box.setReadOnly(True)
        self.contract_status_label = QLabel("Contract isn't Ok")
        self.contract_label = QLabel("Contract")
        self.contract_box = QLineEdit(self)
        self.contract_box.textEdited.connect(self.ip_edited)
        self.contract_tx_label = QLabel("Contract Transaction")
        self.contract_tx_box = QLineEdit(self)
        self.contract_tx_box.textEdited.connect(self.ip_edited)
        self.p_label = QLabel()
        self.p_addr_label = QLabel()
        self.p_addr_box = QLineEdit(self)
        self.p_addr_box.textEdited.connect(self.ip_edited)
        self.p_amount_label = QLabel("Amount")
        self.p_amount_box = QLineEdit(self)
        self.p_amount_box.textEdited.connect(self.ip_edited)
        self.participate_vbox.addWidget(self.p_label)
        self.participate_vbox.addLayout(self.address_hbox)
        self.participate_vbox.addWidget(self.my_address_box)
        self.participate_vbox.addWidget(self.contract_status_label)
        self.participate_vbox.addWidget(self.contract_label)
        self.participate_vbox.addWidget(self.contract_box)
        self.participate_vbox.addWidget(self.contract_tx_label)
        self.participate_vbox.addWidget(self.contract_tx_box)
        self.participate_vbox.addWidget(self.p_addr_label)
        self.participate_vbox.addWidget(self.p_addr_box)
        self.participate_vbox.addWidget(self.p_amount_label)
        self.participate_vbox.addWidget(self.p_amount_box)
        self.participate_vbox.addStretch(1)
        self.ip_widget.addWidget(self.participate_widget)
        self.ip_widget.setCurrentIndex(0)
        self.ip_v_box.addStretch(1)
        self.ip_v_box.addWidget(self.ip_label)
        self.ip_bg.addButton(self.initiate_button, 1)
        self.ip_bg.addButton(self.participate_button, 2)
        self.ip_v_box.addWidget(self.initiate_button)
        self.ip_v_box.addWidget(self.participate_button)
        self.ip_v_box.addWidget(self.ip_widget)
        self.main_widget.addWidget(self.ip)

        # confirm window
        self.confirm = QWidget(self.main_widget)
        self.confirm_vbox = QVBoxLayout(self.confirm)
        self.copy_hbox = QHBoxLayout()
        self.copy_label = QLabel(
            "Please copy and send to your trading partner.")
        self.copy_button = QPushButton("Copy")
        self.copy_hbox.addWidget(self.copy_label)
        self.copy_hbox.addStretch(1)
        self.copy_hbox.addWidget(self.copy_button)
        self.contract_result = QTextEdit(self)
        self.contract_result.setReadOnly(True)
        self.copy_button.clicked.connect(
            lambda: copy(self.contract_result.toPlainText()))
        self.confirm_vbox.addLayout(self.copy_hbox)
        self.confirm_vbox.addWidget(self.contract_result)
        self.main_widget.addWidget(self.confirm)

        # redeem window
        self.redeem = QWidget()
        self.redeem_vbox = QVBoxLayout(self.redeem)
        self.redeem_ip = QStackedWidget()
        self.i_widget = QWidget()
        self.p_widget = QWidget()
        self.i_vbox = QVBoxLayout(self.i_widget)
        self.i_r_label = QLabel(
            "Please input participator's Contract and Contract Transaction.")
        self.i_p_contract_status_label = QLabel("Contract isn't Ok")
        self.i_p_contract_label = QLabel("Contract")
        self.i_p_contract = QLineEdit(self)
        self.i_p_contract.textEdited.connect(self.redeem_edited)
        self.i_p_tx_label = QLabel("Contract Transaction")
        self.i_p_tx = QLineEdit(self)
        self.i_p_tx.textEdited.connect(self.redeem_edited)
        self.i_vbox.addWidget(self.i_r_label)
        self.i_vbox.addWidget(self.i_p_contract_status_label)
        self.i_vbox.addWidget(self.i_p_contract_label)
        self.i_vbox.addWidget(self.i_p_contract)
        self.i_vbox.addWidget(self.i_p_tx_label)
        self.i_vbox.addWidget(self.i_p_tx)
        self.p_vbox = QVBoxLayout(self.p_widget)
        self.redeem_tx_label = QLabel(
            "Please input initiator's redeem transaction.")
        self.redeem_tx_status_label = QLabel("Transaction isn't Ok")
        self.redeem_tx = QLineEdit(self)
        self.redeem_tx.textEdited.connect(self.redeem_edited)
        self.p_vbox.addWidget(self.redeem_tx_label)
        self.p_vbox.addStretch(1)
        self.p_vbox.addWidget(self.redeem_tx_status_label)
        self.p_vbox.addWidget(self.redeem_tx)
        self.redeem_ip.addWidget(self.i_widget)
        self.redeem_ip.addWidget(self.p_widget)
        self.redeem_label = QLabel("Press the Next button to execute redeem.")
        self.redeem_vbox.addWidget(self.redeem_ip)
        self.redeem_vbox.addWidget(self.redeem_label)
        self.redeem_vbox.addStretch(1)
        self.main_widget.addWidget(self.redeem)

        # confirm redeem window (only initiator)
        self.confirm_r = QWidget(self.main_widget)
        self.confirm_r_vbox = QVBoxLayout(self.confirm_r)
        self.copy_r_hbox = QHBoxLayout()
        self.copy_r_label = QLabel(
            "Please copy and send to your trading partner.")
        self.copy_r_button = QPushButton("Copy")
        self.copy_r_hbox.addWidget(self.copy_r_label)
        self.copy_r_hbox.addStretch(1)
        self.copy_r_hbox.addWidget(self.copy_r_button)
        self.redeem_result = QTextEdit(self)
        self.redeem_result.setReadOnly(True)
        self.copy_r_button.clicked.connect(
            lambda: copy(self.redeem_result.toPlainText()))
        self.confirm_r_vbox.addLayout(self.copy_r_hbox)
        self.confirm_r_vbox.addWidget(self.redeem_result)
        self.main_widget.addWidget(self.confirm_r)

        # success atomicswap window
        self.success = QWidget()
        self.success_vbox = QVBoxLayout(self.success)
        self.success_label = QLabel("<h1>Success Atomic Swap!!!</h1>")
        self.success_vbox.addWidget(self.success_label)
        self.success_vbox.addStretch(1)
        self.main_widget.addWidget(self.success)

        # set start window
        self.main_widget.setCurrentWidget(self.start)
        self.main_vbox.addWidget(self.main_widget)
        self.main_vbox.addWidget(self.button_widget)
        self.setCentralWidget(self.main_window)
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.center()
        self.statusBar().showMessage("Ready")
Пример #10
0
    def __init__(self):
        super(MainwindowWidget, self).__init__()
        self.setWindowFlag(Qt.FramelessWindowHint)
        self.factor = QApplication.desktop().screenGeometry().width() / 100
        self.setWindowTitle('SkyDrive')
        self.setWindowIcon(QIcon(':/default/default_icons/SkyDrive.ico'))
        self.resize(self.factor * 80, self.factor * 50)

        self.logo_image = QLabel()
        self.logo_name = QLabel()

        title_function_layout = QHBoxLayout()
        title_function_layout.setSpacing(self.factor)
        self.my_skydrive = QPushButton()
        self.my_skydrive.setCheckable(True)
        self.my_skydrive.setChecked(True)
        self.trans_list = QPushButton()
        self.trans_list.setCheckable(True)
        self.friend_share = QPushButton()
        self.friend_share.setCheckable(True)
        self.button_group = QButtonGroup()
        self.button_group.addButton(self.my_skydrive, 0)
        self.button_group.addButton(self.trans_list, 1)
        self.button_group.addButton(self.friend_share, 2)
        title_function_layout.addWidget(self.my_skydrive)
        title_function_layout.addWidget(self.trans_list)
        title_function_layout.addWidget(self.friend_share)

        user_info_layout = QHBoxLayout()
        user_info_layout.setSpacing(0)
        self.user_image = QLabel()
        self.user_name = SignalPushButton()
        self.user_is_vip = QPushButton()
        user_info_layout.addWidget(self.user_image)
        user_info_layout.addWidget(self.user_name)
        user_info_layout.addWidget(self.user_is_vip)

        tools_layout = QHBoxLayout()
        self.setting_button = QPushButton()
        self.minimize_button = QPushButton(clicked=self.showMinimized)
        self.change_size_button = QPushButton()
        self.change_size_button.setCheckable(True)
        self.close_button = QPushButton(clicked=self.close)
        self.setting_button.setObjectName('setting_button')
        self.minimize_button.setObjectName('minimize_button')
        self.change_size_button.setObjectName('change_size_button')
        self.close_button.setObjectName('close_button')
        # 暂时屏蔽主窗口设置按钮
        # tools_layout.addWidget(self.setting_button)
        tools_layout.addWidget(self.minimize_button)
        tools_layout.addWidget(self.change_size_button)
        tools_layout.addWidget(self.close_button)
        tools_layout.setSpacing(0)

        title_layout = QHBoxLayout()
        title_layout.setSpacing(0)
        title_layout.addWidget(self.logo_image)
        title_layout.addWidget(self.logo_name)
        title_layout.addStretch(2)
        title_layout.addLayout(title_function_layout)
        title_layout.addStretch(12)
        title_layout.addLayout(user_info_layout)
        title_layout.addStretch(1)
        title_layout.addLayout(tools_layout)

        stacked_layout = QStackedWidget()
        self.my_skydrive_widget = MySkyDriveWidget()
        self.trans_list_widget = TransListWidget()
        self.friend_share_widget = QWidget(self)
        stacked_layout.addWidget(self.my_skydrive_widget)
        stacked_layout.addWidget(self.trans_list_widget)
        stacked_layout.addWidget(self.friend_share_widget)

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(stacked_layout)
        self.setLayout(main_layout)
        self.setupUi()

        self.user_info_widget = UserInfoUi()

        self.button_group.buttonClicked[int].connect(
            stacked_layout.setCurrentIndex)
        self.user_name.enter_signal.connect(self.mouseEnter)
        self.user_name.leave_signal.connect(self.mouseLeave)
        self.user_info_widget.enter_signal.connect(self.mouseEnter)
        self.user_info_widget.leave_signal.connect(self.mouseLeave)
        self.my_skydrive_widget.upload_signal.connect(
            self.trans_list_widget.upload_widget.add_items)
        self.my_skydrive_widget.download_signal.connect(
            self.trans_list_widget.download_widget.add_items)
        self.change_size_button.toggled.connect(self.change_size)

        qss = open('./resource/myqss.qss', 'r')
        self.setStyleSheet(qss.read())
Пример #11
0
    def __init__(self, parent, worker, current_status, default=None):
        QDialog.__init__(self, parent)
        self.resize(950, 700)
        self.setWindowTitle('Search/Add from Remote')
        self.worker = worker
        self.current_status = current_status
        self.default = default
        if default:
            self.setWindowTitle('Search/Add from Remote for new show: %s' %
                                default)

        # Get available search methods and default to keyword search if not reported by the API
        search_methods = self.worker.engine.mediainfo.get(
            'search_methods', [utils.SEARCH_METHOD_KW])

        layout = QVBoxLayout()

        # Create top layout
        top_layout = QHBoxLayout()

        if utils.SEARCH_METHOD_KW in search_methods:
            self.search_rad = QRadioButton('By keyword:')
            self.search_rad.setChecked(True)
            self.search_txt = QLineEdit()
            self.search_txt.setClearButtonEnabled(True)
            self.search_txt.returnPressed.connect(self.s_search)
            if default:
                self.search_txt.setText(default)
            self.search_btn = QPushButton('Search')
            self.search_btn.clicked.connect(self.s_search)
            top_layout.addWidget(self.search_rad)
            top_layout.addWidget(self.search_txt)
        else:
            top_layout.setAlignment(QtCore.Qt.AlignRight)

        top_layout.addWidget(self.search_btn)

        # Create filter line
        filters_layout = QHBoxLayout()

        if utils.SEARCH_METHOD_SEASON in search_methods:
            self.season_rad = QRadioButton('By season:')
            self.season_combo = QComboBox()
            self.season_combo.addItem('Winter', utils.SEASON_WINTER)
            self.season_combo.addItem('Spring', utils.SEASON_SPRING)
            self.season_combo.addItem('Summer', utils.SEASON_SUMMER)
            self.season_combo.addItem('Fall', utils.SEASON_FALL)

            self.season_year = QSpinBox()

            today = date.today()
            current_season = (today.month - 1) / 3

            self.season_year.setRange(1900, today.year)
            self.season_year.setValue(today.year)
            self.season_combo.setCurrentIndex(current_season)

            filters_layout.addWidget(self.season_rad)
            filters_layout.addWidget(self.season_combo)
            filters_layout.addWidget(self.season_year)

            filters_layout.setAlignment(QtCore.Qt.AlignLeft)
            filters_layout.addWidget(QSplitter())
        else:
            filters_layout.setAlignment(QtCore.Qt.AlignRight)

        view_combo = QComboBox()
        view_combo.addItem('Card view')
        view_combo.addItem('Table view')
        view_combo.currentIndexChanged.connect(self.s_change_view)

        filters_layout.addWidget(view_combo)

        # Create central content
        self.contents = QStackedWidget()

        # Set up views
        tableview = AddTableDetailsView(None, self.worker)
        tableview.changed.connect(self.s_selected)

        cardview = AddCardView(api_info=self.worker.engine.api_info)
        cardview.changed.connect(self.s_selected)
        cardview.doubleClicked.connect(self.s_show_details)

        self.contents.addWidget(cardview)
        self.contents.addWidget(tableview)

        # Use for testing
        #self.set_results([{'id': 1, 'title': 'Hola', 'image': 'https://omaera.org/icon.png'}])

        bottom_buttons = QDialogButtonBox()
        bottom_buttons.addButton("Cancel", QDialogButtonBox.RejectRole)
        self.add_btn = bottom_buttons.addButton("Add",
                                                QDialogButtonBox.AcceptRole)
        self.add_btn.setEnabled(False)
        bottom_buttons.accepted.connect(self.s_add)
        bottom_buttons.rejected.connect(self.close)

        # Finish layout
        layout.addLayout(top_layout)
        layout.addLayout(filters_layout)
        layout.addWidget(self.contents)
        layout.addWidget(bottom_buttons)
        self.setLayout(layout)

        if utils.SEARCH_METHOD_SEASON in search_methods:
            self.search_txt.setFocus()
Пример #12
0
        if e.key() == Qt.Key_E:
            self.stw.setCurrentIndex(0)


class ThreadClass(QThread):
    def __init__(self, callback, parent=None):
        super(ThreadClass, self).__init__(parent)
        self.point = 0
        self.callback = callback

    def run(self):
        while 1:
            data = s.recv(1024)
            msg = data.decode('utf-8')
            if msg == 'goal':
                self.callback()
                #self.point += 10
                #print(msg, self.point)


if __name__ == "__main__":
    q = QApplication(sys.argv)
    st = QStackedWidget()
    st.addWidget(InitScene(st))
    st.addWidget(PlayScene(st))
    st.addWidget(RankingScene(st))
    st.setGeometry(0, 0, 540, 960)
    st.show()
    sys.exit(q.exec_())
d
Пример #13
0
    def __setupUi(self):
        """Set up the UI.
        """
        if self.__macUnified:
            self.tab = QToolBar()

            self.addToolBar(Qt.TopToolBarArea, self.tab)
            self.setUnifiedTitleAndToolBarOnMac(True)

            # This does not seem to work
            self.setWindowFlags(self.windowFlags() & \
                                ~Qt.MacWindowToolBarButtonHint)

            self.tab.actionTriggered[QAction].connect(
                self.__macOnToolBarAction)

            central = QStackedWidget()

            central.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        else:
            self.tab = central = QTabWidget(self)

        # Add a close button to the bottom of the dialog
        # (to satisfy GNOME 3 which shows the dialog  without a title bar).
        container = container_widget_helper()
        container.layout().addWidget(central)
        buttonbox = QDialogButtonBox(QDialogButtonBox.Close)
        buttonbox.rejected.connect(self.close)
        container.layout().addWidget(buttonbox)

        self.setCentralWidget(container)

        self.stack = central

        # General Tab
        tab = QWidget()
        self.addTab(tab,
                    self.tr("General"),
                    toolTip=self.tr("General Options"))

        form = QFormLayout()
        tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        nodes = QWidget(self, objectName="nodes")
        nodes.setLayout(QVBoxLayout())
        nodes.layout().setContentsMargins(0, 0, 0, 0)

        cb_anim = QCheckBox(self.tr("Enable node animations"),
                            objectName="enable-node-animations",
                            toolTip=self.tr(
                                "Enable shadow and ping animations for nodes "
                                "in the workflow."))
        self.bind(cb_anim, "checked", "schemeedit/enable-node-animations")
        nodes.layout().addWidget(cb_anim)

        form.addRow(self.tr("Nodes"), nodes)

        links = QWidget(self, objectName="links")
        links.setLayout(QVBoxLayout())
        links.layout().setContentsMargins(0, 0, 0, 0)

        cb_show = QCheckBox(self.tr("Show channel names between widgets"),
                            objectName="show-channel-names",
                            toolTip=self.tr(
                                "Show source and sink channel names "
                                "over the links."))

        self.bind(cb_show, "checked", "schemeedit/show-channel-names")

        links.layout().addWidget(cb_show)

        form.addRow(self.tr("Links"), links)

        quickmenu = QWidget(self, objectName="quickmenu-options")
        quickmenu.setLayout(QVBoxLayout())
        quickmenu.layout().setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("On double click"),
                        toolTip=self.tr("Open quick menu on a double click "
                                        "on an empty spot in the canvas"))

        cb2 = QCheckBox(self.tr("On right click"),
                        toolTip=self.tr("Open quick menu on a right click "
                                        "on an empty spot in the canvas"))

        cb3 = QCheckBox(self.tr("On space key press"),
                        toolTip=self.tr("On Space key press while the mouse"
                                        "is hovering over the canvas."))

        cb4 = QCheckBox(self.tr("On any key press"),
                        toolTip=self.tr("On any key press while the mouse"
                                        "is hovering over the canvas."))

        self.bind(cb1, "checked", "quickmenu/trigger-on-double-click")
        self.bind(cb2, "checked", "quickmenu/trigger-on-right-click")
        self.bind(cb3, "checked", "quickmenu/trigger-on-space-key")
        self.bind(cb4, "checked", "quickmenu/trigger-on-any-key")

        quickmenu.layout().addWidget(cb1)
        quickmenu.layout().addWidget(cb2)
        quickmenu.layout().addWidget(cb3)
        quickmenu.layout().addWidget(cb4)

        form.addRow(self.tr("Open quick menu on"), quickmenu)

        startup = QWidget(self, objectName="startup-group")
        startup.setLayout(QVBoxLayout())
        startup.layout().setContentsMargins(0, 0, 0, 0)

        cb_splash = QCheckBox(self.tr("Show splash screen"),
                              self,
                              objectName="show-splash-screen")

        cb_welcome = QCheckBox(self.tr("Show welcome screen"),
                               self,
                               objectName="show-welcome-screen")

        self.bind(cb_splash, "checked", "startup/show-splash-screen")
        self.bind(cb_welcome, "checked", "startup/show-welcome-screen")

        startup.layout().addWidget(cb_splash)
        startup.layout().addWidget(cb_welcome)

        form.addRow(self.tr("On startup"), startup)

        toolbox = QWidget(self, objectName="toolbox-group")
        toolbox.setLayout(QVBoxLayout())
        toolbox.layout().setContentsMargins(0, 0, 0, 0)

        exclusive = QCheckBox(self.tr("Only one tab can be open at a time"))

        self.bind(exclusive, "checked", "mainwindow/toolbox-dock-exclusive")

        toolbox.layout().addWidget(exclusive)

        form.addRow(self.tr("Tool box"), toolbox)
        tab.setLayout(form)

        # Output Tab
        tab = QWidget()
        self.addTab(tab, self.tr("Output"), toolTip="Output Redirection")

        form = QFormLayout()
        box = QWidget(self, objectName="streams")
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Standard output"))
        cb2 = QCheckBox(self.tr("Standard error"))

        self.bind(cb1, "checked", "output/redirect-stdout")
        self.bind(cb2, "checked", "output/redirect-stderr")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        box.setLayout(layout)

        form.addRow(self.tr("Redirect output"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        combo = QComboBox()
        combo.addItems([
            self.tr("Critical"),
            self.tr("Error"),
            self.tr("Warn"),
            self.tr("Info"),
            self.tr("Debug")
        ])

        cb = QCheckBox(self.tr("Show output on 'Error'"),
                       objectName="focus-on-error")

        self.bind(combo, "currentIndex", "logging/level")
        self.bind(cb, "checked", "output/show-on-error")

        layout.addWidget(combo)
        layout.addWidget(cb)
        box.setLayout(layout)

        form.addRow(self.tr("Logging"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Stay on top"), objectName="stay-on-top")

        cb2 = QCheckBox(self.tr("Dockable"), objectName="output-dockable")

        self.bind(cb1, "checked", "output/stay-on-top")
        self.bind(cb2, "checked", "output/dockable")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        box.setLayout(layout)

        form.addRow(self.tr("Output window"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Open in external browser"),
                        objectName="open-in-external-browser")

        cb2 = QCheckBox(self.tr("Stay on top"), objectName="help-stay-on-top")

        cb3 = QCheckBox(self.tr("Dockable"), objectName="help-dockable")

        self.bind(cb1, "checked", "help/open-in-external-browser")
        self.bind(cb2, "checked", "help/stay-on-top")
        self.bind(cb3, "checked", "help/dockable")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        layout.addWidget(cb3)
        box.setLayout(layout)

        form.addRow(self.tr("Help window"), box)

        tab.setLayout(form)

        # Applications Specific
        tab = QWidget()
        self.addTab(tab,
                    self.tr("Applications"),
                    toolTip=self.tr("Applications Specific Options"))

        form = QFormLayout()
        tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        tab.setLayout(form)

        # Categories Tab
        tab = QWidget()
        layout = QVBoxLayout()
        view = QListView()
        from .. import registry
        reg = registry.global_registry()
        model = QStandardItemModel()
        settings = QSettings()
        for cat in reg.categories():
            item = QStandardItem()
            item.setText(cat.name)
            item.setCheckable(True)
            visible, _ = category_state(cat, settings)
            item.setCheckState(Qt.Checked if visible else Qt.Unchecked)
            model.appendRow([item])

        view.setModel(model)
        layout.addWidget(view)
        tab.setLayout(layout)
        model.itemChanged.connect(lambda item: save_category_state(
            reg.category(str(item.text())),
            _State(item.checkState() == Qt.Checked, -1), settings))

        self.addTab(tab, "Categories")

        if self.__macUnified:
            # Need some sensible size otherwise mac unified toolbar 'takes'
            # the space that should be used for layout of the contents
            self.adjustSize()
Пример #14
0
    def __init__(self):
        """
        Constructor for the main application class. Creates the GUI and sets up
        the initial state.
        """
        super().__init__()

        self.player_thread = threading.Thread()
        self.output_screen_size = 32

        # Center master window
        self.resize(400, 200)
        self.center_widget(self, 0)

        # Create widgets
        self.display_widget = DisplayWidget()
        self.media_preview_stack = QStackedWidget()
        open_button = QPushButton("Open")
        clear_button = QPushButton("Clear")
        next_button = QPushButton(QIcon("next.svg"), "")
        previous_button = QPushButton(QIcon("previous.svg"), "")
        preview_label = QLabel()

        self.nav_widget = QWidget()
        self.size_widget = QWidget()
        self.size_checkbox = QCheckBox("Autosize")
        size_lineedit = QLineEdit(str(self.output_screen_size))

        # Configure
        preview_label.setScaledContents(True)
        preview_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        open_button.setToolTip("Choose a media file to display")
        clear_button.setToolTip(
            "Clear the current media and turn off the display")
        size_lineedit.setInputMask("D0 \\i\\n")
        self.nav_widget.setEnabled(False)
        self.media_preview_stack.addWidget(QSvgWidget("blank.svg"))
        self.media_preview_stack.addWidget(preview_label)
        self.display_widget.setScaledContents(True)
        self.display_widget.setStyleSheet("background-color: rgb(20, 20, 20);")
        self.display_widget.closed.connect(self.close)
        self.size_checkbox.setChecked(True)
        self.size_checkbox.setEnabled(False)
        self.size_checkbox.setToolTip(
            "Use automatic screen dimensions for drawing")

        # Set up connections
        open_button.clicked.connect(self.choose_media)
        clear_button.clicked.connect(self.clear_media)
        next_button.clicked.connect(lambda: self.advance_media(1))
        previous_button.clicked.connect(lambda: self.advance_media(-1))
        size_lineedit.editingFinished.connect(self.size_changed)
        self.size_checkbox.stateChanged.connect(self.set_dimensions_visibility)

        # Set shortcuts
        makeShortcut = lambda hotkey: QShortcut(
            QKeySequence(hotkey), self, context=Qt.ApplicationShortcut)
        open_shortcut = makeShortcut("O")
        clear_shortcut = makeShortcut("C")
        close_shortcut = makeShortcut("Ctrl+Q")
        self.next_shortcut = makeShortcut("N")
        self.previous_shortcut = makeShortcut("P")
        self.dimensions_shortcut = makeShortcut("A")
        self.next_shortcut.setEnabled(False)
        self.previous_shortcut.setEnabled(False)
        self.dimensions_shortcut.setEnabled(False)

        open_shortcut.activated.connect(self.choose_media)
        clear_shortcut.activated.connect(self.clear_media)
        close_shortcut.activated.connect(self.close)
        self.next_shortcut.activated.connect(lambda: self.advance_media(1))
        self.previous_shortcut.activated.connect(
            lambda: self.advance_media(-1))
        self.dimensions_shortcut.activated.connect(self.size_checkbox.toggle)

        # Pack layouts
        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        nav_hbox = QHBoxLayout()
        size_hbox = QHBoxLayout()

        nav_hbox.addWidget(previous_button)
        nav_hbox.addWidget(next_button)

        size_hbox.addWidget(QLabel("Size:"))
        size_hbox.addWidget(size_lineedit)

        vbox.addWidget(open_button)
        vbox.addWidget(clear_button)
        vbox.addWidget(self.nav_widget)
        vbox.addWidget(self.size_checkbox)
        vbox.addWidget(self.size_widget)
        vbox.addStretch()

        hbox.addLayout(vbox)
        hbox.addWidget(self.media_preview_stack)

        hbox.setSpacing(20)
        hbox.setContentsMargins(20, 20, 20, 20)
        vbox.setSpacing(10)

        nav_hbox.setContentsMargins(0, 0, 0, 0)
        size_hbox.setContentsMargins(0, 0, 0, 0)
        self.nav_widget.setLayout(nav_hbox)
        self.size_widget.setLayout(size_hbox)

        # Create slave window
        desktop_widget = QDesktopWidget()
        if desktop_widget.screenCount() != 2:
            QMessageBox.warning(self, "Warning", "Cannot find a second screen, " \
                                                 "display will be on primary screen.")
            self.display_widget.showMaximized()
        else:
            self.center_widget(self.display_widget, 1)
            self.display_widget.showFullScreen()

        # Set default values in the screen dimension widgets
        display_geometry = desktop_widget.screenGeometry(self.display_widget)
        self.size_widget.hide()

        self.display_widget.setWindowTitle("Polo - Display")

        self.setLayout(hbox)
        self.setWindowTitle("Polo")
        self.show()
Пример #15
0
    def __init__(self, parent):
        """ :param parent: The parent window/dialog used to enable modal behaviour
            :type parent: :class:`PyQt4.QtGui.QWidget`
        """
        super(SetupDialog,
              self).__init__(parent,
                             Qt.WindowCloseButtonHint | Qt.WindowTitleHint)
        self.setWindowTitle(_('luckyLUKS'))

        self.worker = parent.worker
        self.is_busy = False

        # build ui
        self.layout = QVBoxLayout()
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        style = QApplication.style()
        # set up stacked layout: initially only the main tab pane (unlock/create)
        self.main_pane = QStackedWidget()
        self.tab_pane = QTabWidget()
        self.main_pane.addWidget(self.tab_pane)
        self.layout.addWidget(self.main_pane)
        self.create_pane = None  # init in on_create_container()

        # Unlock Tab
        unlock_grid = QGridLayout()
        unlock_grid.setColumnMinimumWidth(1, 220)
        uheader = QLabel(
            _('<b>Unlock an encrypted container</b>\n') +
            _('Please select container file and name'))
        uheader.setContentsMargins(0, 10, 0, 10)
        unlock_grid.addWidget(uheader, 0, 0, 1, 3, Qt.AlignCenter)

        label = QLabel(_('container file'))
        label.setIndent(5)
        unlock_grid.addWidget(label, 1, 0)
        self.unlock_container_file = QLineEdit()
        unlock_grid.addWidget(self.unlock_container_file, 1, 1)
        button_choose_file = QPushButton(
            style.standardIcon(QStyle.SP_DialogOpenButton), '', self)
        button_choose_file.setToolTip(_('choose file'))
        unlock_grid.addWidget(button_choose_file, 1, 2)
        button_choose_file.clicked.connect(self.on_select_container_clicked)

        label = QLabel(_('device name'))
        label.setIndent(5)
        unlock_grid.addWidget(label, 2, 0)
        self.unlock_device_name = QLineEdit()
        unlock_grid.addWidget(self.unlock_device_name, 2, 1)
        # advanced settings
        a_settings = QExpander(_('Advanced'), self, False)
        unlock_grid.addWidget(a_settings, 3, 0, 1, 3)

        label = QLabel(_('key file'))
        label.setIndent(5)
        unlock_grid.addWidget(label, 4, 0)
        self.unlock_keyfile = QLineEdit()
        unlock_grid.addWidget(self.unlock_keyfile, 4, 1)
        button_choose_uKeyfile = QPushButton(
            style.standardIcon(QStyle.SP_DialogOpenButton), '')
        button_choose_uKeyfile.setToolTip(_('choose keyfile'))
        unlock_grid.addWidget(button_choose_uKeyfile, 4, 2)
        button_choose_uKeyfile.clicked.connect(
            lambda: self.on_select_keyfile_clicked('Unlock'))
        a_settings.addWidgets([
            unlock_grid.itemAtPosition(4, column).widget()
            for column in range(0, 3)
        ])

        label = QLabel(_('mount point'))
        label.setIndent(5)
        unlock_grid.addWidget(label, 5, 0)
        self.unlock_mountpoint = QLineEdit()
        unlock_grid.addWidget(self.unlock_mountpoint, 5, 1)
        button_choose_mountpoint = QPushButton(
            style.standardIcon(QStyle.SP_DialogOpenButton), '')
        button_choose_mountpoint.setToolTip(_('choose folder'))
        unlock_grid.addWidget(button_choose_mountpoint, 5, 2)
        button_choose_mountpoint.clicked.connect(
            self.on_select_mountpoint_clicked)
        a_settings.addWidgets([
            unlock_grid.itemAtPosition(5, column).widget()
            for column in range(0, 3)
        ])

        unlock_grid.setRowStretch(6, 1)
        unlock_grid.setRowMinimumHeight(6, 10)
        button_help_unlock = QPushButton(
            style.standardIcon(QStyle.SP_DialogHelpButton), _('Help'))
        button_help_unlock.clicked.connect(self.show_help_unlock)
        unlock_grid.addWidget(button_help_unlock, 7, 2)

        unlock_tab = QWidget()
        unlock_tab.setLayout(unlock_grid)
        self.tab_pane.addTab(unlock_tab, _('Unlock Container'))

        # Create Tab
        create_grid = QGridLayout()
        cheader = QLabel(
            _('<b>Create a new encrypted container</b>\n') +
            _('Please choose container file, name and size'))
        cheader.setContentsMargins(0, 10, 0, 10)
        create_grid.addWidget(cheader, 0, 0, 1, 3, Qt.AlignCenter)

        label = QLabel(_('container file'))
        label.setIndent(5)
        create_grid.addWidget(label, 1, 0)
        self.create_container_file = QLineEdit()
        create_grid.addWidget(self.create_container_file, 1, 1)
        button_choose_file = QPushButton(
            style.standardIcon(QStyle.SP_DialogOpenButton), '')
        button_choose_file.setToolTip(_('set file'))
        create_grid.addWidget(button_choose_file, 1, 2)
        button_choose_file.clicked.connect(self.on_save_container_clicked)

        label = QLabel(_('device name'))
        label.setIndent(5)
        create_grid.addWidget(label, 2, 0)
        self.create_device_name = QLineEdit()
        create_grid.addWidget(self.create_device_name, 2, 1)

        label = QLabel(_('container size'))
        label.setIndent(5)
        create_grid.addWidget(label, 3, 0)
        self.create_container_size = QSpinBox()
        self.create_container_size.setRange(1, 1000000000)
        self.create_container_size.setValue(1)
        create_grid.addWidget(self.create_container_size, 3, 1)

        self.create_size_unit = QComboBox()
        self.create_size_unit.addItems(['MB', 'GB'])
        self.create_size_unit.setCurrentIndex(1)
        create_grid.addWidget(self.create_size_unit, 3, 2)
        # advanced settings
        a_settings = QExpander(_('Advanced'), self, False)
        create_grid.addWidget(a_settings, 4, 0, 1, 3)

        label = QLabel(_('key file'))
        label.setIndent(5)
        create_grid.addWidget(label, 5, 0)
        self.create_keyfile = QLineEdit()
        create_grid.addWidget(self.create_keyfile, 5, 1)
        button_choose_cKeyfile = QPushButton(
            style.standardIcon(QStyle.SP_DialogOpenButton), '')
        button_choose_cKeyfile.setToolTip(_('choose keyfile'))
        create_grid.addWidget(button_choose_cKeyfile, 5, 2)
        button_choose_cKeyfile.clicked.connect(
            lambda: self.on_select_keyfile_clicked('Create'))
        a_settings.addWidgets([
            create_grid.itemAtPosition(5, column).widget()
            for column in range(0, 3)
        ])

        button_create_keyfile = QPushButton(_('Create key file'))
        button_create_keyfile.clicked.connect(self.on_create_keyfile)
        create_grid.addWidget(button_create_keyfile, 6, 1)
        a_settings.addWidgets([button_create_keyfile])

        label = QLabel(_('format'))
        label.setIndent(5)
        create_grid.addWidget(label, 7, 0)
        self.create_encryption_format = QComboBox()
        self.create_encryption_format.addItem('LUKS')
        self.create_encryption_format.addItem('TrueCrypt')
        if not is_installed('tcplay'):
            self.create_encryption_format.setEnabled(False)
        self.create_encryption_format.setCurrentIndex(0)
        create_grid.addWidget(self.create_encryption_format, 7, 1)
        a_settings.addWidgets([
            create_grid.itemAtPosition(7, column).widget()
            for column in range(0, 2)
        ])

        label = QLabel(_('filesystem'))
        label.setIndent(5)
        create_grid.addWidget(label, 8, 0)
        filesystems = ['ext4', 'ext2', 'ntfs']
        self.create_filesystem_type = QComboBox()
        for filesystem in filesystems:
            if is_installed('mkfs.' + filesystem):
                self.create_filesystem_type.addItem(filesystem)
        self.create_filesystem_type.setCurrentIndex(0)
        create_grid.addWidget(self.create_filesystem_type, 8, 1)
        a_settings.addWidgets([
            create_grid.itemAtPosition(8, column).widget()
            for column in range(0, 2)
        ])

        create_grid.setRowStretch(9, 1)
        create_grid.setRowMinimumHeight(9, 10)
        button_help_create = QPushButton(
            style.standardIcon(QStyle.SP_DialogHelpButton), _('Help'))
        button_help_create.clicked.connect(self.show_help_create)
        create_grid.addWidget(button_help_create, 10, 2)

        create_tab = QWidget()
        create_tab.setLayout(create_grid)
        self.tab_pane.addTab(create_tab, _('Create New Container'))
        self.tab_pane.currentChanged.connect(self.on_switchpage_event)

        # OK and Cancel buttons
        self.buttons = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel,
                                        parent=self)
        self.buttons.button(QDialogButtonBox.Ok).setText(_('Unlock'))
        self.buttons.accepted.connect(self.on_accepted)
        self.buttons.rejected.connect(self.reject)
        self.layout.addWidget(self.buttons)

        # ui built, add to widget
        self.setLayout(self.layout)
Пример #16
0
    def __init__(self):
        super(
            terminal,
            self,
        ).__init__()
        self.resize(900, 600)
        self.setObjectName('terminal')
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.Main_HB = QtWidgets.QHBoxLayout()
        Pixmap = QtGui.QPixmap()
        Pixmap.loadFromData(
            base64.b64decode(bytes(Maimwin_ico, encoding='utf-8')))
        self.Window_out = False
        ico = QtGui.QIcon()
        ico.addPixmap(Pixmap)
        self.iclab = QLabel(self)
        self.tab_menu = QtWidgets.QPushButton('☰', self)
        self.tab_menu.setStyleSheet(
            'line-height: 0.1;font: 7pt "微软雅黑";border-top-right-radius:10px;')
        self.tab_menu.setObjectName("tabmenu")
        self.tab_menu.clicked.connect(self.Title_men)
        self.tab_menu.setMaximumSize(30, 30)
        self.tab_menu.setMinimumSize(30, 30)
        self._MinimumButton = QHead_Button(b'\xef\x80\xb0'.decode("utf-8"),
                                           self)
        self._MinimumButton.setObjectName("MinMaxButton")
        self._MinimumButton.setMaximumSize(30, 30)
        self._MinimumButton.setMinimumSize(30, 30)
        self._MinimumButton.clicked.connect(self.showMinimized)

        self.iclab.setMaximumSize(30, 30)
        self.iclab.setMinimumSize(30, 30)
        self.iclab.setScaledContents(True)
        self.iclab.setPixmap(Pixmap)
        self.setWindowIcon(ico)
        self.Main_HB.addWidget(self.iclab)

        self.title_tab = table(self)
        self.title_tab.setMinimumSize(38, 38)
        self.title_tab.add_tab.clicked.connect(self.Init_lab)
        # self.title_tab.setGeometry(38,0,self.width() - self._ClosButton.width()-38,48)
        # self.title_tab.setStyleSheet('background-color:#FFFFFF')
        # self.title_hb.addWidget(self.title_tab)
        self.Main_HB.addWidget(self.title_tab)
        self.Main_HB.addWidget(self.tab_menu)

        self.Main_HB.addWidget(self._MinimumButton)
        self.Main_HB.addWidget(self._MaximumButton)
        self.Main_HB.addWidget(self._ClosButton)
        self.Main_HB.setContentsMargins(5, 0, 0, 0)
        self.verticalLayout_main.addLayout(self.Main_HB)
        self.window_docker = QStackedWidget(self)

        # spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_main.addWidget(self.window_docker)
        # self.verticalLayout_main.addItem(spacerItem)
        self.verticalLayout_main.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_main.setSpacing(0)
        self._Men = QtWidgets.QMenu(self)
        # self._Men.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self._Men.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        self._Men.setObjectName('TabMen')
        self.Host_often = self._Men.addAction('最近会话')
        self.Host_list = self._Men.addAction('远程管理')
        self.Host_list.triggered.connect(lambda: self.Host_win(True))
        self.Theme = self._Men.addAction('切换主题')
        self._Men.addSeparator()
        self.Setting = self._Men.addAction('设置')
        self.Help = self._Men.addAction('帮助')
        self.Author = self._Men.addAction('关于')
        # self._ClosButton.move(self.width() - self._ClosButton.width() - 1, 5)
        # float_host = QtWidgets.QVBoxLayout(self)
        self.HostListWindow = HostWindow(self)
        # self.HostListWindow = HostWindow()

        # self.HostListWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.HostListWindow.Send_host.connect(self.Add_lab)
        # self.HostListWindow.

        self.win_out = QPropertyAnimation(self.HostListWindow, b"geometry")
        self.win_out.setDuration(300)

        # float_host.addWidget(self.HostListWindow)
        # self.title_hb = QtWidgets.QHBoxLayout(self)
        # self.title_tab = table(self)
        # self.title_tab.setGeometry(38,0,self.width() - self._ClosButton.width()-38,48)
        # self.title_tab.setStyleSheet('background-color:#FFFFFF')
        # self.title_hb.addWidget(self.title_tab)

        # def enterEvent(self,QMouseEvent):
        #     self.setMouseTracking(True)
        self.Lable_viwe = []
        self.Init_lab()
        # self.winqss()
        # def winqss(self):

        self.setStyleSheet(''' 
        
                   QTableView
                       {
                           outline:0px;
                       }
            
            QWidget#main_widget{
                       border-top-right-radius:10px;
                       border-top-left-radius:10px;
                       border-bottom-left-radius:4px;
                       border-bottom-right-radius:4px;
                       /*background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(0, 0, 0, 163));*/
                       /*background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(0, 0, 0, 200));*/
                       background-color: qlineargradient(spread:pad, x1:0.506, y1:0.567818, x2:1, y2:0, stop:1 rgba(0, 37, 56, 200));

             }
             
             QWebEngineView#QWebEng{
                background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(0, 0, 0, 163));
             }
             
             QWidget#QWebEng{
                background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(0, 0, 0, 163));
             }
              QWidget#HostItemWidget:hover{
                background-color:#111111;
            }
            QWidget#UpdateHostWindow{
            background-color:#000000;
            color:#FFFFFF;
            }
             QWidget#HostListWindow{
             background-color:#000000;

             }
             
              QPushButton:hover{
              background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(47, 47, 47, 171));
              }
             QPushButton{
              color:#CCCCCC;
               border:none;
               /*font-family: "微软雅黑";*/
               border-radius:3px;
               background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(37, 37, 37, 171));
             }

             QPushButton#Left_QPush{
             color:#CCCCCC;
             border:none;
             background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
             }
             /*
              QPushButton{
                color:#CCCCCC;
                border:none;
                background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
              }*/





             QPushButton#AddHost:hover{
             background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(47, 47, 47, 171));
             }

                       QPushButton#subButton{
                           border:none;
                           border-radius:3px;
                           line-height: 1;
                           font: 10pt "微软雅黑";
                           padding: 0px;
                           color:#FFFFFF;
                            background-color:#CC6633;
                           outline: none;
                       }
                       QPushButton#subButton:hover {
                            background-color:#AAAAAA;

                       }
                       QPushButton#toolbarbutton{
                           border:none;
                           line-height: 1;
                           font: 10pt "微软雅黑";
                           padding: 9px;
                           text-align:left;
                           outline: none;
                       }
                        QPushButton#toolbarbutton:hover {
                            background-color:#AAAAAA;

                       }

                       QPushButton#toolbarbutton:focus
                       {

                            background-color:#CCCCCC;
                       }
                       QPushButton#ClosButton,#MinMaxButton,#tabmenu,#MinMaxButton{
                       color:#AAAAAA;
                       border:0px;
                       background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
                       }
                       QPushButton#MinMaxButton:hover,#tabmenu:hover,#MinMaxButton:hover{
                           color:#FFFFFF
                       }

                       QPushButton#ClosButton:hover{
                           color:#FF0033
                       }
                        
                       QLabel{
                           line-height: 1.5;
                           color:#999999;
                           font: 6pt "微软雅黑";
                           font-weight: normal;
                           opacity: 0.7;
                           font-size: 16px;
                       }
                        QLabel#TitleLabel{
                        color: #000000;
                        }
                       QLabel#HostItemTitleName{
                       color:#CCCCCC;

                       font: 8pt "微软雅黑";
                       }
                       QLabel#HostItemHost{
                       color:#555555;

                       font: 7pt "微软雅黑";
                       }
                   QLineEdit
                   {
                       background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
                       padding: 5px;
                       border-style: solid;
                       border: 1px solid #00CCFF;
                       border-radius: 2px;
                       color: #999999;

                   }
                   QWebEngineView{
                   background-color: #FFFFFF;
                   }
                   QLineEdit:hover
                   {
                       border: 1px solid #99CC99;

                   }
                   
                   QMenu#TabMen{
                  /* font: 9pt "SimSun";*/
                   font-weight: 400;
                   width: 128px;
                   color:#333333;
                   background-color:  #F7F7F7;
                    border-radius: 5px;
                   }
                   QMenu::item
                    {
                    background-color: transparent;
                    padding:3px 30px;
                    margin:2px 0px; 
                    }
                    QMenu::item:selected
                    {
                        background-color:#00CCFF;
                    }
                    QMenu::separator {
                        height: 2px;
                        background: lightblue;
                        margin-left: 0px;
                        margin-right: 5px;
                    }
                    QMenu::indicator {
                        width: 18px;
                        height: 18px;
                    }
                    
                    QTableWidget#HostTabWindow{
                    border-top: 1px solid #76797C;
                    border-bottom: 1px solid #76797C;
                    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
                    }

                   QScrollBar:vertical
        {
           /* background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));
            */
            background-color:#111111;
            width: 10px;
            margin: 15px 3px 15px 3px;
            border: 0px transparent #2A2929;
            border-radius: 4px;
        }
        QScrollBar::handle:vertical
        {
            /*background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:1 rgba(0, 0, 0, 80));
            */
            background-color: #222222;
            min-height: 5px;
            border-radius: 4px;
        }

        QScrollBar::sub-line:vertical
        {
            margin: 3px 0px 3px 0px;
            border-image: url(rc/up_arrow_disabled.png);
            height: 10px;
            width: 10px;
            subcontrol-position: top;
            subcontrol-origin: margin;
        }

        QScrollBar::add-line:vertical
        {
            margin: 3px 0px 3px 0px;
            border-image: url(rc/down_arrow_disabled.png);
            height: 10px;
            width: 10px;
            subcontrol-position: bottom;
            subcontrol-origin: margin;
        }

        QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on
        {

            border-image: url(rc/up_arrow.png);
            height: 10px;
            width: 10px;
            subcontrol-position: top;
            subcontrol-origin: margin;
        }


        QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on
        {
            border-image: url(rc/down_arrow.png);
            height: 10px;
            width: 10px;
            subcontrol-position: bottom;
            subcontrol-origin: margin;
        }

        QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical
        {
            background: none;
        }


        QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
        {
            background: none;
        }
        

                           ''')
Пример #17
0
    def __init__(self, settings: QSettings):
        super(GeneralTab, self).__init__()
        self.settings = settings

        realdebrid_logo = QLabel(pixmap=QPixmap(':assets/images/realdebrid.png'))
        self.realdebridtoken_lineEdit = QLineEdit(self, text=self.settings.value('realdebrid_apitoken'))
        self.realdebridtoken_lineEdit.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.realdebridtoken_lineEdit.setMinimumWidth(250)
        apitoken_link = '<a href="https://real-debrid.com/apitoken" title="https://real-debrid.com/apitoken" ' \
                        'target="_blank">get your API token here</a>'
        realdebrid_apitoken_link = QLabel(text=apitoken_link, textFormat=Qt.RichText, openExternalLinks=True)
        realdebrid_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
        realdebrid_formLayout.addRow('API Token:', self.realdebridtoken_lineEdit)
        if len(self.realdebridtoken_lineEdit.text()):
            self.realdebridproxy_checkBox = QCheckBox('Use ShadowSocks proxy for API connections', self)
            self.realdebridproxy_checkBox.setChecked(self.settings.value('realdebrid_apiproxy', False, bool))
            self.realdebridproxy_checkBox.setCursor(Qt.PointingHandCursor)
            realdebrid_formLayout.addRow('', self.realdebridproxy_checkBox)
        else:
            realdebrid_formLayout.addRow('', realdebrid_apitoken_link)
        realdebrid_layout = QHBoxLayout()
        realdebrid_layout.addWidget(realdebrid_logo)
        realdebrid_layout.addSpacing(15)
        realdebrid_layout.addLayout(realdebrid_formLayout)
        realdebrid_group = QGroupBox()
        realdebrid_group.setLayout(realdebrid_layout)

        self.dlmanager_comboBox = QComboBox(self, editable=False, cursor=Qt.PointingHandCursor)
        self.dlmanager_comboBox.setAutoFillBackground(True)
        self.dlmanager_comboBox.addItems(('built-in', 'aria2'))
        if sys.platform == 'win32':
            self.dlmanager_comboBox.addItem('IDM')
        if sys.platform.startswith('linux'):
            self.dlmanager_comboBox.addItem('KGet')
        self.dlmanager_comboBox.addItems(('Persepolis', 'pyLoad'))
        self.dlmanager_comboBox.setCurrentIndex(self.dlmanager_comboBox.findText(
            str(self.settings.value('download_manager')), Qt.MatchFixedString))

        # self.dlpagecount_comboBox = QComboBox(self, toolTip='Default Page Count', editable=False,
        #                                       cursor=Qt.PointingHandCursor)
        # self.dlpagecount_comboBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        # self.dlpagecount_comboBox.addItems(('10', '20', '30', '40', '50'))
        # self.dlpagecount_comboBox.setCurrentIndex(self.dlpagecount_comboBox.findText(
        #     str(self.settings.value('dl_pagecount')), Qt.MatchFixedString))

        minchars = 20

        self.dlmanager_comboBox.setMinimumContentsLength(minchars)
        # self.dlpagecount_comboBox.setMinimumContentsLength(minchars)

        general_formlayout = QFormLayout(labelAlignment=Qt.AlignRight)
        general_formlayout.addRow('Download Manager:', self.dlmanager_comboBox)
        general_layout = QHBoxLayout()
        general_layout.addStretch(1)
        general_layout.addLayout(general_formlayout)
        general_layout.addStretch(1)

        directdl_label = QLabel('No settings for built-in downloader')
        directdl_label.setStyleSheet('font-weight:300; text-align:center;')
        directdl_label.setAlignment(Qt.AlignCenter)

        self.aria2rpchost_lineEdit = QLineEdit(self, text=self.settings.value('aria2_rpc_host'))
        self.aria2rpchost_lineEdit.setPlaceholderText('http://localhost')
        self.aria2rpchost_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.aria2rpcport_lineEdit = QLineEdit(self, text=self.settings.value('aria2_rpc_port'))
        self.aria2rpcport_lineEdit.setPlaceholderText('6800')
        self.aria2rpcport_lineEdit.setFixedWidth(100)
        self.aria2rpcsecret_lineEdit = QLineEdit(self, text=self.settings.value('aria2_rpc_secret'))
        self.aria2rpcsecret_lineEdit.setFixedWidth(100)
        self.aria2rpcsecret_lineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
        self.aria2rpcuser_lineEdit = QLineEdit(self, text=self.settings.value('aria2_rpc_username'))
        self.aria2rpcuser_lineEdit.setFixedWidth(150)
        self.aria2rpcpass_lineEdit = QLineEdit(self, text=self.settings.value('aria2_rpc_password'))
        self.aria2rpcpass_lineEdit.setFixedWidth(150)
        self.aria2rpcpass_lineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
        aria2_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
        aria2_formLayout.addRow('RPC Host:', self.aria2rpchost_lineEdit)
        aria2_formLayout_left = QFormLayout(labelAlignment=Qt.AlignRight)
        aria2_formLayout_left.addRow('RPC Port:', self.aria2rpcport_lineEdit)
        aria2_formLayout_left.addRow('RPC Secret:', self.aria2rpcsecret_lineEdit)
        aria2_formLayout_right = QFormLayout(labelAlignment=Qt.AlignRight)
        aria2_formLayout_right.addRow('RPC Username:'******'RPC Password:'******'persepolis_cmd'))
        self.persepoliscmd_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        persepolis_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
        persepolis_formLayout.addRow('persepolis command:', self.persepoliscmd_lineEdit)
        persepolis_settings = QWidget(self)
        persepolis_settings.setLayout(persepolis_formLayout)

        self.pyloadhost_lineEdit = QLineEdit(self, text=self.settings.value('pyload_host'))
        self.pyloadhost_lineEdit.setPlaceholderText('http://localhost:8000')
        self.pyloadhost_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.pyloaduser_lineEdit = QLineEdit(self, text=self.settings.value('pyload_username'))
        self.pyloaduser_lineEdit.setFixedWidth(200)
        self.pyloadpass_lineEdit = QLineEdit(self, text=self.settings.value('pyload_password'))
        self.pyloadpass_lineEdit.setFixedWidth(200)
        pyload_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
        pyload_formLayout.addRow('pyLoad Host:', self.pyloadhost_lineEdit)
        pyload_formLayout.addRow('pyLoad Username:'******'pyLoad Password:'******'win32':
            self.idmexepath_lineEdit = QLineEdit(self, text=self.settings.value('idm_exe_path'))
            self.idmexepath_lineEdit.setPlaceholderText('C:\Program Files (x86)\Internet Download Manager\IDMan.exe')
            self.idmexepath_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
            idm_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
            idm_formLayout.addRow('IDM EXE Path:', self.idmexepath_lineEdit)
            idm_settings = QWidget(self)
            idm_settings.setLayout(idm_formLayout)
            self.dlmanagersettings_stack.addWidget(idm_settings)

        if sys.platform.startswith('linux'):
            self.kgetcmd_lineEdit = QLineEdit(self, text=self.settings.value('kget_cmd'))
            self.kgetcmd_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
            kget_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
            kget_formLayout.addRow('kget command:', self.kgetcmd_lineEdit)
            kget_settings = QWidget(self)
            kget_settings.setLayout(kget_formLayout)
            self.dlmanagersettings_stack.addWidget(kget_settings)

        self.dlmanagersettings_stack.addWidget(persepolis_settings)
        self.dlmanagersettings_stack.addWidget(pyload_settings)

        self.dlmanagersettings_stack.setCurrentIndex(self.dlmanager_comboBox.currentIndex())
        self.dlmanager_comboBox.currentIndexChanged.connect(self.dlmanagersettings_stack.setCurrentIndex)

        general_formlayout.addRow(self.dlmanagersettings_stack)
        general_group = QGroupBox()
        general_group.setLayout(general_layout)

        tab_layout = QVBoxLayout()
        tab_layout.addStretch(1)
        tab_layout.addWidget(realdebrid_group)
        tab_layout.addWidget(general_group)
        tab_layout.addStretch(1)

        self.setLayout(tab_layout)
Пример #18
0
    def __init__(self, trainermanager, pluginloader):
        # Building tha mainwindow
        QMainWindow.__init__(self)

        self._trainermanager = trainermanager

        self.setWindowTitle('ML Gui')
        self.resize(900, 600)

        self._mlgui_directory = self.mlGetSavingDirectory()

        # Building the MenuBar
        mainMenu = self.menuBar()

        # Building the Manage menu
        manageMenu = mainMenu.addMenu('&Manage')
        self._newTrainerMenu = mainMenu.addMenu('&Trainer')
        """
        networkMenu = mainMenu.addMenu('&Network')
        """

        # Building the DIsplay Menu
        displayMenu = mainMenu.addMenu('&Displays')
        displayTrainers = QAction('&Trainers', self)
        displayTrainers.triggered.connect(self.mlOnDisplayTrainers)
        displayMenu.addAction(displayTrainers)
        displayNetworks = QAction('&Networks', self)
        displayNetworks.triggered.connect(self.mlOnDisplayNetworks)
        displayMenu.addAction(displayNetworks)

        # Build the trainer viewer
        self._trainerviewer = MLTrainerViewerUI(self._trainermanager)
        self._trainerviewer.mlShowSelectedTrainerPlotSignal.connect(
            self.mlOnShowSelectedTrainerPlots)

        # Build the network viewer
        self._networkviewer = MLNetworkViewerUI()
        self._networkviewer.mlShowNetworkSignal.connect(
            self.mlOnShowNetworkViewer)

        # Build the plugin viewer
        self._pluginviewer = MLPluginViewerUI()
        self._pluginviewer.setVisible(False)
        self.addDockWidget(Qt.RightDockWidgetArea, self._pluginviewer)
        pluginViewerAction = self._pluginviewer.toggleViewAction()
        pluginViewerAction.setCheckable(True)
        manageMenu.addAction(pluginViewerAction)

        # Build the Help Menu
        help = QAction('&Help', self)
        manageMenu.addAction(help)

        quit = QAction('Quit', self)
        quit.triggered.connect(self.close)
        manageMenu.addAction(quit)

        # Build the default label
        self._mainLabel = QLabel()

        # build the statckwidget
        stackwidget = QStackedWidget()
        stackwidget.addWidget(self._mainLabel)
        stackwidget.addWidget(self._trainerviewer)
        stackwidget.addWidget(self._trainerviewer.mlGetTrainerOverview())
        stackwidget.addWidget(self._networkviewer)
        stackwidget.addWidget(self._networkviewer.mlGetNetworkViewer())

        # Build the central widget
        self.setCentralWidget(stackwidget)

        # Register all plugins
        self.mlRegisterAllPlugins(pluginloader)
Пример #19
0
    def __init__(self):
        super(MainWindow, self).__init__()

        # init for stack_n1
        self.command_group1 = QButtonGroup(self)
        self.qrb_nr = QRadioButton("Remove")
        self.qrb_na = QRadioButton("Add")
        self.command_group1.addButton(self.qrb_nr)
        self.command_group1.addButton(self.qrb_na)
        self.command_n = QHBoxLayout()
        self.command_n.addWidget(self.qrb_na)
        self.command_n.addWidget(self.qrb_nr)
        self.qle_n2 = QLineEdit()
        self.qle_n3 = QLineEdit()
        self.qle_n4 = QLineEdit()
        self.qle_n5 = QLineEdit()
        self.qle_n6 = QLineEdit()
        self.qle_n7 = QLineEdit()
        self.qle_n8 = QLineEdit()
        self.qle_n9 = QLineEdit()
        self.qle_n10 = QLineEdit()
        self.qle_n11 = QLineEdit()

        # init for stack_gw2
        self.command_group2 = QButtonGroup(self)
        self.qrb_gwr = QRadioButton("Remove")
        self.qrb_gwa = QRadioButton("Add")
        self.command_group2.addButton(self.qrb_gwr)
        self.command_group2.addButton(self.qrb_gwa)
        self.command_gw = QHBoxLayout()
        self.command_gw.addWidget(self.qrb_gwa)
        self.command_gw.addWidget(self.qrb_gwr)
        self.qle_gw2 = QLineEdit()
        self.qle_gw3 = QLineEdit()
        self.qle_gw4 = QLineEdit()
        self.qle_gw5 = QLineEdit()
        self.qle_gw6 = QLineEdit()
        self.qle_gw7 = QLineEdit()

        # init for stack_timeular
        self.command_group3 = QButtonGroup(self)
        self.qrb_tr = QRadioButton("Remove")
        self.qrb_ta = QRadioButton("Add")
        self.command_group3.addButton(self.qrb_tr)
        self.command_group3.addButton(self.qrb_ta)
        self.command_t = QHBoxLayout()
        self.command_t.addWidget(self.qrb_ta)
        self.command_t.addWidget(self.qrb_tr)

        self.qle_t2 = QLineEdit()
        self.qle_t3 = QLineEdit()

        self.time_group = QButtonGroup(self)
        self.qrb_td = QRadioButton("Daily")
        self.qrb_tw = QRadioButton("Weekly")
        self.qrb_tm = QRadioButton("Monthly")
        self.time_group.addButton(self.qrb_td)
        self.time_group.addButton(self.qrb_tw)
        self.time_group.addButton(self.qrb_tm)
        self.qle_t4 = QHBoxLayout()
        self.qle_t4.addWidget(self.qrb_td)
        self.qle_t4.addWidget(self.qrb_tw)
        self.qle_t4.addWidget(self.qrb_tm)

        self.qle_t5 = QLineEdit()
        self.qle_t6 = QLineEdit()
        self.qle_t7 = QLineEdit()

        self.butt = QPushButton("Press to send", self)

        self.setWindowTitle("Config UI")

        self.dd1 = QComboBox(self)
        self.dd1.insertItem(0, 'Nike')
        self.dd1.insertItem(1, 'Google Weather')
        self.dd1.insertItem(3, 'Timeular')
        # "timeular tracker"

        self.stack1 = QWidget()
        self.stack2 = QWidget()
        self.stack3 = QWidget()

        self.stack1ui()
        self.stack2ui()
        self.stack3ui()

        self.Stack = QStackedWidget(self)
        self.Stack.addWidget(self.stack1)
        self.Stack.addWidget(self.stack2)
        self.Stack.addWidget(self.stack3)

        box = QVBoxLayout(self)
        box.addWidget(self.dd1)
        box.addWidget(self.Stack)
        box.addWidget(self.butt)

        self.butt.clicked.connect(self.button_clicked)
        self.dd1.currentIndexChanged.connect(self.display)
        self.setGeometry(300, 300, 600, 300)

        # test config_classes

        # example dictionaries OUTDATED
        # example_dict = {
        #     "api_name": "Nike",
        #     "command": "add",
        #     "graph_type": "progress_bar",
        #     "data_type": "calories",
        #     "username": "******",
        #     "password": "******"
        # }

        # example_u = {
        #     "api_name": "google_weather",
        #     "command": "add",
        #     "graph_type": "display_value",
        #     "data_type": "temperature",
        #     "coordinates": "30,40"
        # }

        # **list => not edited everywhere
        # test = CommandMessage(**example_dict)

        # Call to send a command
        self.command_function = None
Пример #20
0
    def __setupUi(self):
        """
        Private method to perform the general setup of the configuration
        widget.
        """
        self.setObjectName("ConfigurationDialog")
        self.resize(900, 650)
        self.verticalLayout_2 = QVBoxLayout(self)
        self.verticalLayout_2.setSpacing(6)
        self.verticalLayout_2.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        
        self.configSplitter = QSplitter(self)
        self.configSplitter.setOrientation(Qt.Horizontal)
        self.configSplitter.setObjectName("configSplitter")
        
        self.configListWidget = QWidget(self.configSplitter)
        self.leftVBoxLayout = QVBoxLayout(self.configListWidget)
        self.leftVBoxLayout.setContentsMargins(0, 0, 0, 0)
        self.leftVBoxLayout.setSpacing(0)
        self.leftVBoxLayout.setObjectName("leftVBoxLayout")
        self.configListSearch = E5ClearableLineEdit(
            self, self.tr("Enter search text..."))
        self.configListSearch.setObjectName("configListSearch")
        self.leftVBoxLayout.addWidget(self.configListSearch)
        self.configList = QTreeWidget()
        self.configList.setObjectName("configList")
        self.leftVBoxLayout.addWidget(self.configList)
        self.configListSearch.textChanged.connect(self.__searchTextChanged)
        
        self.scrollArea = QScrollArea(self.configSplitter)
        self.scrollArea.setFrameShape(QFrame.NoFrame)
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scrollArea.setWidgetResizable(False)
        self.scrollArea.setObjectName("scrollArea")
        
        self.configStack = QStackedWidget()
        self.configStack.setFrameShape(QFrame.Box)
        self.configStack.setFrameShadow(QFrame.Sunken)
        self.configStack.setObjectName("configStack")
        self.scrollArea.setWidget(self.configStack)
        
        self.emptyPage = QWidget()
        self.emptyPage.setGeometry(QRect(0, 0, 372, 591))
        self.emptyPage.setObjectName("emptyPage")
        self.vboxlayout = QVBoxLayout(self.emptyPage)
        self.vboxlayout.setSpacing(6)
        self.vboxlayout.setContentsMargins(6, 6, 6, 6)
        self.vboxlayout.setObjectName("vboxlayout")
        spacerItem = QSpacerItem(
            20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.vboxlayout.addItem(spacerItem)
        self.emptyPagePixmap = QLabel(self.emptyPage)
        self.emptyPagePixmap.setAlignment(Qt.AlignCenter)
        self.emptyPagePixmap.setObjectName("emptyPagePixmap")
        self.emptyPagePixmap.setPixmap(
            QPixmap(os.path.join(getConfig('ericPixDir'), 'pymakr_small.png')))
        self.vboxlayout.addWidget(self.emptyPagePixmap)
        self.textLabel1 = QLabel(self.emptyPage)
        self.textLabel1.setAlignment(Qt.AlignCenter)
        self.textLabel1.setObjectName("textLabel1")
        self.vboxlayout.addWidget(self.textLabel1)
        spacerItem1 = QSpacerItem(
            20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.vboxlayout.addItem(spacerItem1)
        self.configStack.addWidget(self.emptyPage)
        
        self.verticalLayout_2.addWidget(self.configSplitter)
        
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.Apply | QDialogButtonBox.Cancel |
            QDialogButtonBox.Ok | QDialogButtonBox.Reset)
        self.buttonBox.setObjectName("buttonBox")
        if not self.fromEric and \
                self.displayMode == ConfigurationWidget.DefaultMode:
            self.buttonBox.button(QDialogButtonBox.Apply).hide()
        self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
        self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
        self.verticalLayout_2.addWidget(self.buttonBox)

        self.setWindowTitle(self.tr("Preferences"))
        
        self.configList.header().hide()
        self.configList.header().setSortIndicator(0, Qt.AscendingOrder)
        self.configList.setSortingEnabled(True)
        self.textLabel1.setText(
            self.tr("Please select an entry of the list \n"
                    "to display the configuration page."))
        
        QMetaObject.connectSlotsByName(self)
        self.setTabOrder(self.configList, self.configStack)
        
        self.configStack.setCurrentWidget(self.emptyPage)
        
        self.configList.setFocus()
Пример #21
0
 def __init__(self, parent: QWidget):
     super(SettingsWidget, self).__init__(parent, Qt.Window)
     # config parser
     self._cfg = configparser.ConfigParser()
     # layouts
     self._layout_main = QVBoxLayout()
     self._layout_stacks = QHBoxLayout()
     self._layout_okcancel = QHBoxLayout()
     # sections list
     self._sections_list = QListWidget(self)
     self._sections_list.setSelectionMode(QAbstractItemView.SingleSelection)
     self._sections_list.setSelectionBehavior(QAbstractItemView.SelectItems)
     self._sections_list.setIconSize(QSize(32, 32))
     self._sections_list.setViewMode(QListView.IconMode)
     self._sections_list.setMaximumWidth(80)
     self._sections_list.setGridSize(QSize(64, 64))
     self._sections_list.setFlow(QListView.TopToBottom)
     self._sections_list.setMovement(
         QListView.Static)  # items cannot be moved by user
     # network item
     lwi = QListWidgetItem()
     lwi.setText(self.tr('Network'))
     lwi.setTextAlignment(Qt.AlignCenter)
     lwi.setIcon(QIcon(':/i/settings_network_32.png'))
     lwi.setData(Qt.UserRole, QVariant(0))
     self._sections_list.addItem(lwi)
     lwi.setSelected(True)
     # misc item
     lwi = QListWidgetItem()
     lwi.setText(self.tr('Other'))
     lwi.setTextAlignment(Qt.AlignCenter)
     lwi.setIcon(QIcon(':/i/settings_32.png'))
     lwi.setData(Qt.UserRole, QVariant(1))
     self._sections_list.addItem(lwi)
     # connections
     self._sections_list.currentItemChanged.connect(
         self.on_section_current_item_changed)
     self._layout_stacks.addWidget(self._sections_list)
     # stacked widget
     self._stack = QStackedWidget(self)
     self._w_net = Settings_Net(self._stack)
     self._w_misc = Settings_Misc(self._stack)
     self._stack.addWidget(self._w_net)
     self._stack.addWidget(self._w_misc)
     self._stack.setCurrentIndex(0)
     self._layout_stacks.addWidget(self._stack)
     # ok cancel buttons
     self._btn_ok = QPushButton(self)
     self._btn_ok.setText(self.tr('Save'))
     self._btn_ok.setIcon(QIcon(':/i/save.png'))
     self._btn_cancel = QPushButton(self)
     self._btn_cancel.setText(self.tr('Cancel'))
     self._btn_cancel.setIcon(QIcon(':/i/cancel.png'))
     self._layout_okcancel.addStretch()
     self._layout_okcancel.addWidget(self._btn_ok)
     self._layout_okcancel.addWidget(self._btn_cancel)
     self._btn_ok.clicked.connect(self.on_ok)
     self._btn_cancel.clicked.connect(self.on_cancel)
     # final
     self._layout_main.addLayout(self._layout_stacks)
     self._layout_main.addLayout(self._layout_okcancel)
     self.setLayout(self._layout_main)
     self.setWindowTitle(self.tr('Settings'))
     self.setWindowIcon(QIcon(':/i/settings_32.png'))
     #
     self.load_settings()
Пример #22
0
    def init_gui(self):
        layout = QGridLayout()

        self.setFixedSize(320, 400)

        self.box = roundQGroupBox()
        self.box.setTitle("DMD control")
        box_layout = QGridLayout()
        self.box.setLayout(box_layout)

        self.setLayout(layout)

        self.connect_button = QPushButton('Connect')
        self.connect_button.setStyleSheet(
            'QPushButton {background-color: #A3C1DA;}')
        self.register_button = QPushButton('Register')

        lasers = ['640', '532', '488']
        self.transform_for_laser_menu = QListWidget()
        self.transform_for_laser_menu.addItems(lasers)
        self.transform_for_laser_menu.setFixedHeight(52)
        self.transform_for_laser_menu.setFixedWidth(82)
        self.transform_for_laser_menu.setCurrentRow(0)
        self.project_button = QPushButton('Start projecting')
        self.project_button.setStyleSheet(
            'QPushButton {background-color: #99FFCC;}')
        self.clear_button = QPushButton('Clear memory')
        self.white_project_button = QPushButton('Full illum.')
        self.white_project_button.setStyleSheet(
            'QPushButton {background-color: #FFE5CC;}')
        self.load_mask_container_stack = QStackedWidget()

        self.connect_button.clicked.connect(self.connect)
        self.register_button.clicked.connect(lambda: self.register(
            self.transform_for_laser_menu.selectedItems()[0].text()))
        self.project_button.clicked.connect(self.project)
        self.clear_button.clicked.connect(self.clear)
        self.white_project_button.clicked.connect(self.project_full_white)

        # Stack page 1
        self.load_mask_container_1 = roundQGroupBox()
        self.load_mask_container_1.setTitle('Load mask')
        load_mask_container_layout_1 = QGridLayout()
        self.load_mask_container_1.setLayout(load_mask_container_layout_1)
        self.load_mask_from_widget_button = QPushButton('From mask generator')
        self.load_mask_from_file_button = QPushButton('From file')
        self.load_mask_from_widget_button.clicked.connect(
            self.load_mask_from_widget)
        self.load_mask_from_file_button.clicked.connect(
            self.load_mask_from_memory)
        load_mask_container_layout_1.addWidget(
            self.load_mask_from_widget_button, 0, 0)
        load_mask_container_layout_1.addWidget(self.load_mask_from_file_button,
                                               1, 0)

        # Stack page 2
        self.load_mask_container_2 = roundQGroupBox()
        self.load_mask_container_2.setTitle('Load mask')
        load_mask_container_layout_2 = QGridLayout()
        self.load_mask_container_2.setLayout(load_mask_container_layout_2)
        self.load_image = QPushButton('Image')
        self.load_folder = QPushButton('Folder')
        self.load_video = QPushButton('Video')
        self.back_load_mask_container_index0 = QPushButton('Back')

        self.load_image.clicked.connect(self.load_mask_from_file)
        self.load_folder.clicked.connect(self.load_mask_from_folder)
        self.back_load_mask_container_index0.clicked.connect(
            lambda: self.load_mask_container_stack.setCurrentIndex(0))

        load_mask_container_layout_2.addWidget(self.load_image, 0, 0, 1, 2)
        load_mask_container_layout_2.addWidget(self.load_folder, 1, 0, 1, 2)
        load_mask_container_layout_2.addWidget(self.load_video, 2, 0)
        load_mask_container_layout_2.addWidget(
            self.back_load_mask_container_index0, 2, 1)

        ## Add layers to stack
        self.load_mask_container_stack.addWidget(self.load_mask_container_1)
        self.load_mask_container_stack.addWidget(self.load_mask_container_2)

        # Detailed settings
        self.settings_container = roundQGroupBox()
        self.settings_container.setTitle('Settings')
        settings_container_layout = QGridLayout()
        self.settings_container.setLayout(settings_container_layout)

        settings_container_layout.addWidget(QLabel('ALP_PROJ_MODE'), 0, 0)
        self.ALP_PROJ_MODE_Combox = QComboBox()
        self.ALP_PROJ_MODE_Combox.addItems(['ALP_MASTER', 'ALP_SLAVE'])
        self.ALP_PROJ_MODE_Combox.setToolTip(
            "This ControlType is used to select from an internal or external trigger source."
        )
        settings_container_layout.addWidget(self.ALP_PROJ_MODE_Combox, 0, 1)

        settings_container_layout.addWidget(QLabel('ALP_PROJ_STEP'), 2, 0)
        self.ALP_PROJ_STEP_Combox = QComboBox()
        self.ALP_PROJ_STEP_Combox.addItems(['ALP_DEFAULT', 'ALP_EDGE_RISING'])
        self.ALP_PROJ_STEP_Combox.setToolTip(
            "Set frame switching trigger method in the sequence.(Only in ALP_MASTER mode)"
        )
        settings_container_layout.addWidget(self.ALP_PROJ_STEP_Combox, 2, 1)

        settings_container_layout.addWidget(QLabel('ALP_BIN_MODE'), 3, 0)
        self.ALP_ALP_BIN_MODE_Combox = QComboBox()
        self.ALP_ALP_BIN_MODE_Combox.addItems(
            ['ALP_BIN_UNINTERRUPTED', 'ALP_BIN_NORMAL'])
        self.ALP_ALP_BIN_MODE_Combox.setToolTip(
            "Binary mode: select from ALP_BIN_NORMAL and ALP_BIN_UNINTERRUPTED (No dark phase between frames)"
        )
        # self.ALP_ALP_BIN_MODE_Combox.currentIndexChanged.connect(self.set_repeat_from_BIN_MODE)
        settings_container_layout.addWidget(self.ALP_ALP_BIN_MODE_Combox, 3, 1)

        self.frame_rate_textbox = QLineEdit()
        self.frame_rate_textbox.setValidator(QtGui.QIntValidator())
        self.frame_rate_textbox.setText('1000000')  # Default 33334

        self.repeat_imgseq_button = QCheckBox()
        self.repeat_imgseq_button.setChecked(True)
        self.repeat_imgseq_button.setToolTip("Repeat the sequence.")

        Illumination_time_label = QLabel(u"Illumination time(µs):")
        Illumination_time_label.setToolTip(
            "Display time of a single image of the sequence in microseconds. PictureTime is set to minimize the dark time according to illuminationTime, +44 us e.g."
        )

        settings_container_layout.addWidget(Illumination_time_label, 4, 0)
        settings_container_layout.addWidget(self.frame_rate_textbox, 4, 1)
        settings_container_layout.addWidget(QLabel('Repeat sequence:'), 5, 0)
        settings_container_layout.addWidget(self.repeat_imgseq_button, 5, 1)

        box_layout.addWidget(self.connect_button, 0, 0)
        box_layout.addWidget(self.register_button, 0, 1)
        box_layout.addWidget(QLabel('Register with laser:'), 1, 1)
        box_layout.addWidget(self.transform_for_laser_menu, 2, 1, 2, 1)
        box_layout.addWidget(self.project_button, 2, 0)
        box_layout.addWidget(self.clear_button, 3, 0)
        box_layout.addWidget(self.white_project_button, 1, 0)

        box_layout.addWidget(self.load_mask_container_stack, 4, 0, 1, 2)
        box_layout.addWidget(self.settings_container, 5, 0, 1, 2)

        layout.addWidget(self.box)

        self.open_latest_transformation()
Пример #23
0
    def initUI(self):
        """# Global """
        self.setWindowTitle('Option')
        self.setFixedSize(800, 450)

        self.list_option = QListWidget(self)
        self.stack_window = QStackedWidget(self)

        self.style_list_option = "QListWidget{\
                                min-width: 120px;\
                                max-width: 120px;\
                                color: white;\
                                background: grey;}"

        self.style_groupbox = "QGroupBox{\
                               border: None;}"

        self.style_groupbox_font = "QGroupBox{\
                                    font-family: MonoxRegular;\
                                    font-size: 20px;}"

        layout_main = QHBoxLayout(spacing=0)
        layout_main.setContentsMargins(0, 0, 0, 0)

        layout_main.addWidget(self.list_option)
        layout_main.addWidget(self.stack_window)
        self.setLayout(layout_main)

        self.list_option.setStyleSheet(self.style_list_option)
        """# List Option"""
        self.list_option.setFrameShape(QListWidget.NoFrame)
        self.list_option.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.list_option.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        self.list_option.currentRowChanged.connect(
            self.stack_window.setCurrentIndex)

        font = QFont()
        font.setFamily('MonoxLight')
        font.setPointSize(20)

        item = QListWidgetItem()
        item.setFont(font)
        item.setText('DIY')
        item.setSizeHint(QSize(0, 60))
        item.setTextAlignment(Qt.AlignCenter)
        self.list_option.addItem(item)

        item = QListWidgetItem()
        item.setFont(font)
        item.setText('PRO')
        item.setSizeHint(QSize(0, 60))
        item.setTextAlignment(Qt.AlignCenter)
        self.list_option.addItem(item)

        self.page0_pre()
        self.page0tab0()
        self.page0tab1()
        self.page0global()
        self.page1_pre()
        self.page1tab0()
        self.page1tab1()
        self.page1global()
Пример #24
0
    def __setup_ui(self):
        # main window settings
        self.setMinimumSize(QSize(480, 80))
        self.setWindowTitle("RTA - Russian Text Analyzer")

        # central widget setup
        central_widget = QWidget(self)
        self.setCentralWidget(central_widget)

        # update status bar
        self.statusBar().show()
        self.statusBar().showMessage("Загрузка компонентов завершена", 4000)

        # left bar & stacked widget setup
        self.__left_bar = QListWidget(central_widget)
        self.__stacked_widget = QStackedWidget(central_widget)
        self.__left_bar.setMaximumWidth(200)

        self.__left_bar.currentRowChanged.connect(
            self.__display)  # change widget on a __stacked_widget

        # Setup Menu
        bar = self.menuBar()

        file = bar.addMenu("Файл")
        file.addAction("Открыть")
        file.triggered[QAction].connect(self.__open_file)

        analysis_menu = bar.addMenu("Анализ")
        self.__action_start = analysis_menu.addAction("Начать анализ")
        analysis_menu.addSeparator()
        self.__action_graphematical = analysis_menu.addAction(
            "Графематический анализ")
        self.__action_morphological = analysis_menu.addAction(
            "Морфологический анализ")
        self.__action_statistical = analysis_menu.addAction(
            "Статистический анализ")
        self.__action_syntax = analysis_menu.addAction("Синтаксический анализ")
        self.__action_semantic = analysis_menu.addAction(
            "Семантический анализ")
        self.__action_complex = analysis_menu.addAction("Комплексный анализ")

        analysis_menu.triggered[QAction].connect(self.__process_analysis_menu)

        self.__action_graphematical.setCheckable(True)
        self.__action_morphological.setCheckable(True)
        self.__action_statistical.setCheckable(True)
        self.__action_syntax.setCheckable(True)
        self.__action_semantic.setCheckable(True)
        self.__action_complex.setCheckable(True)

        utils_menu = bar.addMenu("Инструменты")
        # self.__action_sentiment = utils_menu.addAction("Сентимент-анализ")
        self.__action_graph_editor = utils_menu.addAction("Редактор графов")
        self.__action_linguistic_analyzer = utils_menu.addAction(
            "Лингвистический анализатор")
        self.__action_text_classifier = utils_menu.addAction(
            "Классификатор текста")

        utils_menu.triggered[QAction].connect(self.__process_utils_menu)

        help_menu = bar.addMenu("Помощь")
        self.__action_docs = help_menu.addAction("Документация")

        help_menu.triggered[QAction].connect(self.__process_help_menu)

        # analysers creating & setup
        self.__left_bar.addItem('Документ')
        self.__stacked_widget.addWidget(self.__text_edit)

        # layout setup
        hbox_layout = QHBoxLayout()
        splitter = QSplitter(Qt.Horizontal)
        splitter.addWidget(self.__left_bar)
        splitter.addWidget(self.__stacked_widget)
        hbox_layout.addWidget(splitter)
        central_widget.setLayout(hbox_layout)
Пример #25
0
    def __init__(self, parent=None, statusBar=None):
        logging.debug("ConnectionWidget instantiated")
        QtWidgets.QWidget.__init__(self, parent=None)
        self.statusBar = statusBar
        self.experimentItemNames = {}
        self.connectionBaseWidgets = {}
        self.eco = ExperimentConfigIO.getInstance()

        self.setObjectName("ConnectionWidget")

        self.windowWidget = QtWidgets.QWidget()
        self.windowWidget.setObjectName("windowWidget")
        self.windowBoxHLayout = QtWidgets.QHBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxHLayout.setObjectName("windowBoxHLayout")
        self.windowWidget.setLayout(self.windowBoxHLayout)

        self.experimentTree = QtWidgets.QTreeWidget(parent)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.header().resizeSection(0, 150)
        self.experimentTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.experimentTree.customContextMenuRequested.connect(
            self.showContextMenu)
        self.experimentTree.itemSelectionChanged.connect(self.onItemSelected)
        self.experimentTree.setEnabled(True)
        self.experimentTree.setMinimumSize(200, 521)
        self.experimentTree.setMaximumWidth(350)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.headerItem().setText(0, "Experiments New")
        self.experimentTree.setSortingEnabled(False)
        self.windowBoxHLayout.addWidget(self.experimentTree)

        self.windowBoxVLayout = QtWidgets.QVBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxVLayout.setObjectName("windowBoxVLayout")

        self.basedataStackedWidget = QStackedWidget()
        self.basedataStackedWidget.setObjectName("basedataStackedWidget")
        self.basedataStackedWidget.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.basedataStackedWidget)

        self.refreshConnsButton = QtWidgets.QPushButton("Refresh Status")
        self.refreshConnsButton.clicked.connect(self.refreshConnsStatus)
        self.refreshConnsButton.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.refreshConnsButton)

        self.windowBoxHLayout.addLayout(self.windowBoxVLayout)

        # Context menu
        self.connsContextMenu = QtWidgets.QMenu()
        self.createGuac = self.connsContextMenu.addAction("Create Users")
        self.createGuac.triggered.connect(self.menuItemSelected)
        self.removeGuac = self.connsContextMenu.addAction("Remove Users")
        self.removeGuac.triggered.connect(self.menuItemSelected)
        self.clearGuac = self.connsContextMenu.addAction("Clear All Entries")
        self.clearGuac.triggered.connect(self.menuItemSelected)
        self.openGuac = self.connsContextMenu.addAction("Open Connections")
        self.openGuac.triggered.connect(self.menuItemSelected)

        self.setLayout(self.windowBoxHLayout)
        self.retranslateUi()
Пример #26
0
    def __init__(self, window, parent=None):
        super(TabWidget, self).__init__(parent)

        self._window = None  # BrowserWindow
        self._tabBar = None  # TabBar
        self._locationBars = None  # QStackedWidget
        self._closedTabsManager = None  # ClosedTabsManager

        self._menuTabs = None  # MenuTabs
        self._buttonListTabs = None  # ToolButton
        self._menuClosedTabs = None  # QMenu
        self._buttonClosedTabs = None  # ToolButton
        self._buttonAddTab = None  # AddTabButton
        self._buttonAddTab2 = None  # AddTabButton

        self._lastBackgroundTab = None  # QPoint<WebTab>

        self._dontCloseWithOneTab = False
        self._showClosedTabsButton = False
        self._newTabAfterActive = False
        self._newEmptyTabAfterActive = False
        self._urlOnNewTab = QUrl()  # QUrl

        self._currentTabFresh = False
        self._blockTabMovedSignal = False

        # start init
        self._window = window
        self._locationBars = QStackedWidget()
        self._closedTabsManager = ClosedTabsManager()

        self.setObjectName('tabWidget')
        self._tabBar = TabBar(self._window, self)
        self.setTabBar(self._tabBar)

        self.changed.connect(gVar.app.changeOccurred)
        self.pinStateChanged.connect(self.changed)

        self._tabBar.tabCloseRequested.connect(self.requestCloseTab)
        self._tabBar.tabMoved.connect(self._tabWasMoved)

        self._tabBar.moveAddTabButton.connect(self.moveAddTabButton)
        gVar.app.settingsReloaded.connect(self._loadSettings)

        self._menuTabs = MenuTabs(self)
        self._menuTabs.closeTab.connect(self.requestCloseTab)

        self._menuClosedTabs = QMenu(self)

        # AddTab button displayed next to last tab
        self._buttonAddTab = AddTabButton(self, self._tabBar)
        self._buttonAddTab.setProperty('outside-tabbar', False)
        self._buttonAddTab.clicked.connect(self._window.addTab)

        # AddTab button displayed ouside tabbar (as corner widget)
        self._buttonAddTab2 = AddTabButton(self, self._tabBar)
        self._buttonAddTab2.setProperty('outside-tabbar', True)
        self._buttonAddTab2.hide()
        self._buttonAddTab2.clicked.connect(self._window.addTab)

        # ClosedTabs button displayed as a permanet corner widget
        self._buttonClosedTabs = ToolButton(self._tabBar)
        self._buttonClosedTabs.setObjectName('tabwidget-button-closedtabs')
        self._buttonClosedTabs.setMenu(self._menuClosedTabs)
        self._buttonClosedTabs.setPopupMode(QToolButton.InstantPopup)
        self._buttonClosedTabs.setToolTip('Closed tabs')
        self._buttonClosedTabs.setAutoRaise(True)
        self._buttonClosedTabs.setFocusPolicy(Qt.NoFocus)
        self._buttonClosedTabs.setShowMenuInside(True)
        self._buttonClosedTabs.aboutToShowMenu.connect(
            self._aboutToShowClosedTabsMenu)

        # ListTabs button is showed only when tabbar overflows
        self._buttonListTabs = ToolButton(self._tabBar)
        self._buttonListTabs.setObjectName('tabwidget-button-opentabs')
        self._buttonListTabs.setMenu(self._menuTabs)
        self._buttonListTabs.setPopupMode(QToolButton.InstantPopup)
        self._buttonListTabs.setToolTip('List of tabs')
        self._buttonListTabs.setAutoRaise(True)
        self._buttonListTabs.setFocusPolicy(Qt.NoFocus)
        self._buttonListTabs.setShowMenuInside(True)
        self._buttonListTabs.hide()
        self._buttonListTabs.aboutToShowMenu.connect(self._aboutToShowTabsMenu)

        self._tabBar.addCornerWidget(self._buttonAddTab2, Qt.TopRightCorner)
        self._tabBar.addCornerWidget(self._buttonClosedTabs, Qt.TopRightCorner)
        self._tabBar.addCornerWidget(self._buttonListTabs, Qt.TopRightCorner)
        self._tabBar.overFlowChanged.connect(self.tabBarOverFlowChanged)

        self._loadSettings()
Пример #27
0
    def _setupUi(self):  # has to take place *before* base elements creation
        self.setWindowTitle("moneyGuru")
        self.resize(700, 580)
        self.centralwidget = QWidget(self)
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.topBar = QWidget(self.centralwidget)
        self.horizontalLayout_2 = QHBoxLayout(self.topBar)
        self.horizontalLayout_2.setContentsMargins(2, 0, 2, 0)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.dateRangeSelectorView = DateRangeSelectorView(self.topBar)
        self.dateRangeSelectorView.setMinimumSize(QSize(220, 0))
        self.horizontalLayout_2.addWidget(self.dateRangeSelectorView)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.searchLineEdit = SearchEdit(self.topBar)
        self.searchLineEdit.setMaximumSize(QSize(240, 16777215))
        self.horizontalLayout_2.addWidget(self.searchLineEdit)
        self.verticalLayout.addWidget(self.topBar)
        self.tabBar = TabBarPlus(self.centralwidget)
        self.tabBar.setMinimumSize(QSize(0, 20))
        self.verticalLayout.addWidget(self.tabBar)
        self.mainView = QStackedWidget(self.centralwidget)
        self.verticalLayout.addWidget(self.mainView)

        # Bottom buttons & status label
        self.bottomBar = QWidget(self.centralwidget)
        self.horizontalLayout = QHBoxLayout(self.bottomBar)
        self.horizontalLayout.setContentsMargins(2, 2, 2, 2)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.newItemButton = QPushButton(self.bottomBar)
        buttonSizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        buttonSizePolicy.setHorizontalStretch(0)
        buttonSizePolicy.setVerticalStretch(0)
        buttonSizePolicy.setHeightForWidth(
            self.newItemButton.sizePolicy().hasHeightForWidth())
        self.newItemButton.setSizePolicy(buttonSizePolicy)
        self.newItemButton.setIcon(QIcon(QPixmap(':/plus_8')))
        self.horizontalLayout.addWidget(self.newItemButton)
        self.deleteItemButton = QPushButton(self.bottomBar)
        self.deleteItemButton.setSizePolicy(buttonSizePolicy)
        self.deleteItemButton.setIcon(QIcon(QPixmap(':/minus_8')))
        self.horizontalLayout.addWidget(self.deleteItemButton)
        self.editItemButton = QPushButton(self.bottomBar)
        self.editItemButton.setSizePolicy(buttonSizePolicy)
        self.editItemButton.setIcon(QIcon(QPixmap(':/info_gray_12')))
        self.horizontalLayout.addWidget(self.editItemButton)
        self.horizontalLayout.addItem(horizontalSpacer(size=20))
        self.graphVisibilityButton = QPushButton()
        self.graphVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.graphVisibilityButton.setIcon(
            QIcon(QPixmap(':/graph_visibility_on_16')))
        self.horizontalLayout.addWidget(self.graphVisibilityButton)
        self.piechartVisibilityButton = QPushButton()
        self.piechartVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.piechartVisibilityButton.setIcon(
            QIcon(QPixmap(':/piechart_visibility_on_16')))
        self.horizontalLayout.addWidget(self.piechartVisibilityButton)
        self.columnsVisibilityButton = QPushButton()
        self.columnsVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.columnsVisibilityButton.setIcon(QIcon(QPixmap(':/columns_16')))
        self.horizontalLayout.addWidget(self.columnsVisibilityButton)

        self.statusLabel = QLabel(tr("Status"))
        self.statusLabel.setAlignment(Qt.AlignCenter)
        self.horizontalLayout.addWidget(self.statusLabel)
        self.verticalLayout.addWidget(self.bottomBar)

        self.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 700, 20))
        self.menuFile = QMenu(tr("File"))
        self.menuOpenRecent = QMenu(tr("Open Recent"))
        self.menuView = QMenu(tr("View"))
        self.menuDateRange = QMenu(tr("Date Range"))
        self.menuEdit = QMenu(tr("Edit"))
        self.menuHelp = QMenu(tr("Help"))
        self.setMenuBar(self.menubar)
        self.actionOpenDocument = QAction(tr("Open..."), self)
        self.actionOpenDocument.setShortcut("Ctrl+O")
        self.actionShowNetWorth = QAction(tr("Net Worth"), self)
        self.actionShowNetWorth.setShortcut("Ctrl+1")
        self.actionShowNetWorth.setIcon(QIcon(QPixmap(':/balance_sheet_48')))
        self.actionShowProfitLoss = QAction(escapeamp(tr("Profit & Loss")),
                                            self)
        self.actionShowProfitLoss.setShortcut("Ctrl+2")
        self.actionShowProfitLoss.setIcon(
            QIcon(QPixmap(':/income_statement_48')))
        self.actionShowTransactions = QAction(tr("Transactions"), self)
        self.actionShowTransactions.setShortcut("Ctrl+3")
        self.actionShowTransactions.setIcon(
            QIcon(QPixmap(':/transaction_table_48')))
        self.actionShowSelectedAccount = QAction(tr("Show Account"), self)
        self.actionShowSelectedAccount.setShortcut("Ctrl+]")
        self.actionNewItem = QAction(tr("New Item"), self)
        self.actionNewItem.setShortcut("Ctrl+N")
        self.actionDeleteItem = QAction(tr("Remove Selected"), self)
        self.actionEditItem = QAction(tr("Show Info"), self)
        self.actionEditItem.setShortcut("Ctrl+I")
        self.actionToggleGraph = QAction(tr("Toggle Graph"), self)
        self.actionToggleGraph.setShortcut("Ctrl+Alt+G")
        self.actionTogglePieChart = QAction(tr("Toggle Pie Chart"), self)
        self.actionTogglePieChart.setShortcut("Ctrl+Alt+P")
        self.actionMoveUp = QAction(tr("Move Up"), self)
        self.actionMoveUp.setShortcut("Ctrl++")
        self.actionMoveDown = QAction(tr("Move Down"), self)
        self.actionMoveDown.setShortcut("Ctrl+-")
        self.actionNavigateBack = QAction(tr("Go Back"), self)
        self.actionNavigateBack.setShortcut("Ctrl+[")
        self.actionNewAccountGroup = QAction(tr("New Account Group"), self)
        self.actionNewAccountGroup.setShortcut("Ctrl+Shift+N")
        self.actionShowNextView = QAction(tr("Next View"), self)
        self.actionShowNextView.setShortcut("Ctrl+Shift+]")
        self.actionShowPreviousView = QAction(tr("Previous View"), self)
        self.actionShowPreviousView.setShortcut("Ctrl+Shift+[")
        self.actionNewDocument = QAction(tr("New Document"), self)
        self.actionImport = QAction(tr("Import..."), self)
        self.actionImport.setShortcut("Ctrl+Alt+I")
        self.actionExport = QAction(tr("Export..."), self)
        self.actionExport.setShortcut("Ctrl+Alt+E")
        self.actionSave = QAction(tr("Save"), self)
        self.actionSave.setShortcut("Ctrl+S")
        self.actionSaveAs = QAction(tr("Save As..."), self)
        self.actionSaveAs.setShortcut("Ctrl+Shift+S")
        self.actionAbout = QAction(tr("About moneyGuru"), self)
        self.actionToggleReconciliationMode = QAction(
            tr("Toggle Reconciliation Mode"), self)
        self.actionToggleReconciliationMode.setShortcut("Ctrl+Shift+R")
        self.actionToggleAccountExclusion = QAction(
            tr("Toggle Exclusion Status of Account"), self)
        self.actionToggleAccountExclusion.setShortcut("Ctrl+Shift+X")
        self.actionShowSchedules = QAction(tr("Schedules"), self)
        self.actionShowSchedules.setShortcut("Ctrl+4")
        self.actionShowSchedules.setIcon(QIcon(QPixmap(':/schedules_48')))
        self.actionReconcileSelected = QAction(tr("Reconcile Selection"), self)
        self.actionReconcileSelected.setShortcut("Ctrl+R")
        self.actionMakeScheduleFromSelected = QAction(
            tr("Make Schedule from Selected"), self)
        self.actionMakeScheduleFromSelected.setShortcut("Ctrl+M")
        self.actionShowPreferences = QAction(tr("Preferences..."), self)
        self.actionPrint = QAction(tr("Print..."), self)
        self.actionPrint.setShortcut("Ctrl+P")
        self.actionQuit = QAction(tr("Quit moneyGuru"), self)
        self.actionQuit.setShortcut("Ctrl+Q")
        self.actionUndo = QAction(tr("Undo"), self)
        self.actionUndo.setShortcut("Ctrl+Z")
        self.actionRedo = QAction(tr("Redo"), self)
        self.actionRedo.setShortcut("Ctrl+Y")
        self.actionShowHelp = QAction(tr("moneyGuru Help"), self)
        self.actionShowHelp.setShortcut("F1")
        self.actionDuplicateTransaction = QAction(tr("Duplicate Transaction"),
                                                  self)
        self.actionDuplicateTransaction.setShortcut("Ctrl+D")
        self.actionJumpToAccount = QAction(tr("Jump to Account..."), self)
        self.actionJumpToAccount.setShortcut("Ctrl+Shift+A")
        self.actionNewTab = QAction(tr("New Tab"), self)
        self.actionNewTab.setShortcut("Ctrl+T")
        self.actionCloseTab = QAction(tr("Close Tab"), self)
        self.actionCloseTab.setShortcut("Ctrl+W")

        self.menuFile.addAction(self.actionNewDocument)
        self.menuFile.addAction(self.actionNewTab)
        self.menuFile.addAction(self.actionOpenDocument)
        self.menuFile.addAction(self.menuOpenRecent.menuAction())
        self.menuFile.addAction(self.actionImport)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionCloseTab)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSaveAs)
        self.menuFile.addAction(self.actionExport)
        self.menuFile.addAction(self.actionPrint)
        self.menuFile.addAction(self.actionQuit)
        self.menuView.addAction(self.actionShowNetWorth)
        self.menuView.addAction(self.actionShowProfitLoss)
        self.menuView.addAction(self.actionShowTransactions)
        self.menuView.addAction(self.actionShowSchedules)
        self.menuView.addAction(self.actionShowPreviousView)
        self.menuView.addAction(self.actionShowNextView)
        self.menuView.addAction(self.menuDateRange.menuAction())
        self.menuView.addAction(self.actionShowPreferences)
        self.menuView.addAction(self.actionToggleGraph)
        self.menuView.addAction(self.actionTogglePieChart)
        self.menuEdit.addAction(self.actionNewItem)
        self.menuEdit.addAction(self.actionNewAccountGroup)
        self.menuEdit.addAction(self.actionDeleteItem)
        self.menuEdit.addAction(self.actionEditItem)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionMoveUp)
        self.menuEdit.addAction(self.actionMoveDown)
        self.menuEdit.addAction(self.actionDuplicateTransaction)
        self.menuEdit.addAction(self.actionMakeScheduleFromSelected)
        self.menuEdit.addAction(self.actionReconcileSelected)
        self.menuEdit.addAction(self.actionToggleReconciliationMode)
        self.menuEdit.addAction(self.actionToggleAccountExclusion)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionShowSelectedAccount)
        self.menuEdit.addAction(self.actionNavigateBack)
        self.menuEdit.addAction(self.actionJumpToAccount)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionUndo)
        self.menuEdit.addAction(self.actionRedo)
        self.menuHelp.addAction(self.actionShowHelp)
        self.menuHelp.addAction(self.actionAbout)
        mainmenus = [
            self.menuFile, self.menuEdit, self.menuView, self.menuHelp
        ]
        for menu in mainmenus:
            self.menubar.addAction(menu.menuAction())
            setAccelKeys(menu)
        setAccelKeys(self.menubar)
        self.tabBar.setMovable(True)
        self.tabBar.setTabsClosable(True)
        self.tabBar.setExpanding(False)

        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Right)
        self._shortcutNextTab = QShortcut(seq, self)
        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Left)
        self._shortcutPrevTab = QShortcut(seq, self)
Пример #28
0
    def __init__(self):
        super().__init__()

        self.noteQDialog = QTwoFieldDialog()
        self.noteQDialog.setWindowIcon(QIcon('design/images/icon.ico'))
        self.noteQDialog.resize(600, 480)
        localize.set_add_note_localization(self.noteQDialog)

        self.bookmarkQDialog = QInputDialog()
        self.bookmarkQDialog.setInputMode(QInputDialog.TextInput)
        self.bookmarkQDialog.setWindowIcon(QIcon('design/images/icon.ico'))
        self.bookmarkQDialog.resize(600, 480)
        localize.set_add_bookmark_localization(self.bookmarkQDialog)
        ColorsRegulator().set_colors(self.bookmarkQDialog,
                                     styles.Styles.set_dialog_styles,
                                     night_styles.NightStyles.set_dialog_styles)

        # Main body
        self.bodyQHBoxLayout = QVBoxLayout()
        self.body = QWidget()

        self.stack = QStackedWidget()
        self.stack.addWidget(self.body)

        # Container
        self.containerQHBoxLayout = QHBoxLayout()
        self.containerQHBoxLayout.setSpacing(50)
        self.container = QWidget()

        # SideBar
        self.sidebarQVBoxLayout = QVBoxLayout()
        self.sidebar = QWidget()
        self.sidebar.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        self.sidebarQVBoxLayout.setSpacing(50)

        # Back Button
        self.backQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.backQButton,
                                         'design/images/back.png',
                                         'design/images/night/night_back.png')
        ColorsRegulator().set_colors(self.backQButton,
                                     styles.Styles.set_back_button_styles,
                                     night_styles.NightStyles.set_back_button_styles)
        self.backQButton.setIconSize(QSize(32, 32))
        self.backQButton.setFocusPolicy(Qt.NoFocus)
        self.backQButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # Button menu
        self.buttonMenuQVBoxLayout = QVBoxLayout()
        self.buttonMenuQVBoxLayout.setContentsMargins(0, 0, 0, 0)
        self.buttonMenu = QWidget()

        # Fullscreen Button
        self.fullscreenQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.fullscreenQButton,
                                         'design/images/fullscreen.png',
                                         'design/images/night/night_fullscreen.png')
        ColorsRegulator().set_colors(self.fullscreenQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.fullscreenQButton.setIconSize(QSize(32, 32))
        self.fullscreenQButton.setFocusPolicy(Qt.NoFocus)

        # Zoom In Button
        self.zoomInQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.zoomInQButton,
                                         'design/images/zoom-in.png',
                                         'design/images/night/night_zoom-in.png')
        ColorsRegulator().set_colors(self.zoomInQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.zoomInQButton.setIconSize(QSize(32, 32))
        self.zoomInQButton.setFocusPolicy(Qt.NoFocus)

        # Zoom Out Button
        self.zoomOutQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.zoomOutQButton,
                                         'design/images/zoom-out.png',
                                         'design/images/night/night_zoom-out.png')
        ColorsRegulator().set_colors(self.zoomOutQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.zoomOutQButton.setIconSize(QSize(32, 32))
        self.zoomOutQButton.setFocusPolicy(Qt.NoFocus)

        # Show Content Button
        self.contentQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.contentQButton,
                                         'design/images/content.png',
                                         'design/images/night/night_content.png')
        ColorsRegulator().set_colors(self.contentQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.contentQButton.setIconSize(QSize(32, 32))
        self.contentQButton.setFocusPolicy(Qt.NoFocus)

        # Add Bookmarks Button
        self.addBookmarkQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.addBookmarkQButton,
                                         'design/images/bookmark.png',
                                         'design/images/night/night_bookmark.png')
        ColorsRegulator().set_colors(self.addBookmarkQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.addBookmarkQButton.setIconSize(QSize(32, 32))
        self.addBookmarkQButton.setFocusPolicy(Qt.NoFocus)

        # Add Notes Button
        self.addNoteQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.addNoteQButton,
                                         'design/images/notes.png',
                                         'design/images/night/night_notes.png')
        ColorsRegulator().set_colors(self.addNoteQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)
        self.addNoteQButton.setIconSize(QSize(32, 32))
        self.addNoteQButton.setFocusPolicy(Qt.NoFocus)

        # Switch mode Button
        self.switchModeQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.switchModeQButton,
                                         'design/images/switch.png',
                                         'design/images/night/night_switch.png')
        ColorsRegulator().set_colors(self.switchModeQButton,
                                     styles.Styles.set_button_style,
                                     night_styles.NightStyles.set_button_style)

        self.switchModeQButton.setIconSize(QSize(32, 32))
        self.switchModeQButton.setFocusPolicy(Qt.NoFocus)

        # Content
        self.content = QLabel()
        self.content.setAlignment(Qt.AlignCenter)
        self.content.adjustSize()
        self.content.setWordWrap(True)

        # Scroll Area for Reader Window
        self.scrollArea = QScrollArea()
        self.scrollArea.setWidget(self.content)
        self.scrollArea.setWidgetResizable(True)

        # Content window
        self.content_window = None

        # Fullscreen Window
        self.fullscreen_window = None

        # Footer
        self.footerQHBoxLayout = QHBoxLayout()
        self.footerQHBoxLayout.setSpacing(20)
        self.footer = QWidget()
        self.footer.setContentsMargins(11, 0, 0, 0)

        # Show progress Label
        self.progressLabel = QLabel()
        self.progressLabel.setAlignment(Qt.AlignCenter)
        self.progressLabel.setFixedSize(QSize(95, 100))

        # Switch page block
        self.switchPageQHBoxLayout = QHBoxLayout()
        self.switchPageWidget = QWidget()
        self.switchPageQHBoxLayout.setSpacing(20)

        # Previous Page Button
        self.previousPageQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.previousPageQButton,
                                         'design/images/back.png',
                                         'design/images/night/night_back.png')
        ColorsRegulator().set_colors(self.previousPageQButton,
                                     styles.Styles.set_switch_buttons_style,
                                     night_styles.NightStyles.set_switch_buttons_style)
        self.previousPageQButton.setIconSize(QSize(32, 32))
        self.previousPageQButton.setFocusPolicy(Qt.NoFocus)

        # Next Page Button
        self.nextPageQButton = QPushButton()
        ColorsRegulator().set_icon_color(self.nextPageQButton,
                                         'design/images/front.png',
                                         'design/images/night/night_front.png')
        ColorsRegulator().set_colors(self.nextPageQButton,
                                     styles.Styles.set_switch_buttons_style,
                                     night_styles.NightStyles.set_switch_buttons_style)

        self.nextPageQButton.setIconSize(QSize(32, 32))
        self.nextPageQButton.setFocusPolicy(Qt.NoFocus)

        localize.set_reader_localization(self)
        ColorsRegulator().set_colors(self,
                                     styles.Styles.set_window_styles,
                                     night_styles.NightStyles.set_window_styles)
        styles.Styles.set_content_colors(self)
        self.init_body()
Пример #29
0
    def __init__(self, parent=None):
        super().__init__(
            parent,
            Qt.MSWindowsFixedSizeDialogHint
            | Qt.WindowTitleHint
            | Qt.WindowSystemMenuHint
            | Qt.WindowCloseButtonHint,
        )
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle(self.tr("About"))

        app = QApplication.instance()
        name = app.applicationName()
        domain = app.organizationDomain()

        iconLabel = QLabel(self)
        iconLabel.setAlignment(Qt.AlignCenter)
        iconLabel.setMaximumWidth(250)
        iconLabel.setMinimumSize(250, 210)
        icon = self.windowIcon()
        size = icon.actualSize(QSize(186, 186))
        iconLabel.setPixmap(icon.pixmap(size))
        titleLabel = QLabel(self)
        titleLabel.setText(
            self.
            tr("<p style='color: #353535; font-size: 24pt; font-weight: 250'>"
               "TruFont Font Editor</p>"
               "<p style='font-size: 13pt; font-weight: 400'>{} Pristine Wax</p>"
               ).format(__version__))
        textLabel = QLabel(self)
        text = self.tr(
            "<p>{n} is a free and open source font editor and scripting "
            "environment made by the developers of the {n} community.</p>"
            "<p>{n} is built upon the "
            "<a href='http://ts-defcon.readthedocs.org/en/ufo3/' "
            "style='color: #356FDE'>defcon</a> UFO library and exposes a "
            "<a href='http://robofab.com/' style='color: #356FDE'>robofab</a>"
            "-like API for scripting purposes.</p>"
            "<p>Running on Qt {} (PyQt {}).</p>"
            "<p>Version {} {} – Python {}.").format(
                QT_VERSION_STR,
                PYQT_VERSION_STR,
                __version__,
                gitShortHash,
                platform.python_version(),
                n=name,
            )
        if domain:
            text += self.tr(
                "<br>See <a href='http://{d}' style='color: #356FDE'>{d}</a> "
                "for more information.</p>").format(d=domain)
        else:
            text += "</p>"
        textLabel.setText(text)
        textLabel.setOpenExternalLinks(True)
        textLabel.setWordWrap(True)

        authorsLabel = QTextBrowser(self)
        authorsLabel.setText("\n".join(self.authors()))

        licenseLabel = QTextBrowser(self)
        licenseLabel.setText(licenseText)

        thanksLabel = QTextBrowser(self)
        thanksLabel.setText(thanksText)

        self.stackWidget = QStackedWidget(self)
        self.stackWidget.addWidget(textLabel)
        self.stackWidget.addWidget(authorsLabel)
        self.stackWidget.addWidget(licenseLabel)
        self.stackWidget.addWidget(thanksLabel)

        textLayout = QVBoxLayout()
        textLayout.setContentsMargins(0, 14, 16, 16)
        textLayout.addWidget(titleLabel)
        textLayout.addWidget(self.stackWidget)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        textLayout.addWidget(spacer)

        mainLayout = QHBoxLayout()
        mainLayout.addWidget(iconLabel)
        mainLayout.addLayout(textLayout)

        frame = QFrame()
        frame.setMinimumHeight(54)
        frame.setMaximumHeight(54)
        frame.setStyleSheet("background: rgb(230, 230, 230)")

        buttonsLayout = QHBoxLayout(frame)
        for index, text in enumerate(("Authors", "License", "Credits")):
            label = QLabel(text, self)
            label.setAlignment(Qt.AlignCenter)
            label.setCursor(Qt.PointingHandCursor)
            label.setProperty("index", index + 1)
            label.setStyleSheet("color: #356FDE; text-decoration: underline")
            label.installEventFilter(self)
            buttonsLayout.addWidget(label)

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(mainLayout)
        layout.addWidget(frame)
Пример #30
0
    def initUI(self):
        self.resize(1200, 800)
        #self.setGeometry(450,100,1200,800)
        self.setWindowTitle('中医药数据特征选择分析平台')
        #无边框
        #self.setWindowFlag(Qt.FramelessWindowHint)

        self.list_widget = QListWidget()
        self.item_list = ['平台首页', '数据导入', '特征选择', '数据中心', '反馈建议', '关于我们']
        self.list_widget.addItems(self.item_list)

        #设置item间隔
        self.list_widget.setSpacing(5)

        #创建各个功能子窗口
        self.home = HomeWindow.HomeWindow()
        self.input_widget = IW.InputWindowDemo()
        self.select_feature_widget = SW.SelectionWindowdemo()
        # self.analyze_data_widget = QWidget()
        self.database_widget = QWidget()  #DataCenterWindow.DataCenterWindow()
        # self.algorithm_widget = QWidget()
        # self.konwledge_widget = QWidget()
        self.contact_widget = ContactWindow.ConcatWindow()
        self.about_widget = AboutUSWindow.AboutUSWindowDemo()

        #将各个功能子窗口压入栈窗口
        self.stack_widget = QStackedWidget()
        self.stack_widget.addWidget(self.home)
        self.stack_widget.addWidget(self.input_widget)
        self.stack_widget.addWidget(self.select_feature_widget)
        # self.stack_widget.addWidget(self.analyze_data_widget)
        self.stack_widget.addWidget(self.database_widget)
        #self.stack_widget.addWidget(self.algorithm_widget)
        #self.stack_widget.addWidget(self.konwledge_widget)
        self.stack_widget.addWidget(self.contact_widget)
        self.stack_widget.addWidget(self.about_widget)

        #布局
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.list_widget)
        hlayout.addWidget(self.stack_widget)
        #等比例划分布局
        hlayout.setStretch(0, 1)
        hlayout.setStretch(1, 5)
        hlayout.setSpacing(0)

        vlayout = QVBoxLayout()
        vlayout.addLayout(hlayout)
        vlayout.setStretch(0, 1)
        vlayout.setStretch(1, 15)
        self.setLayout(vlayout)

        #美化:
        #去边框
        self.list_widget.setFrameShape(False)
        #icon
        self.setWindowIcon(QIcon('./image/分析.png'))
        # self.label.setPixmap(QPixmap('./image/分析.png'))

        #关联单击信号
        self.list_widget.currentRowChanged.connect(self.onClickedListWidget)
        #导入数据窗口与特征选择窗口信号与槽关联,用于传递导入的数据
        self.home.user_button.clicked.connect(self.onClickedUserBuuton)