def __init__(self, type_='success', title='', text=''): super().__init__() self.setObjectName("dialog") self.setFixedWidth(300) self.setWindowIcon(QIcon('assets/icon.png')) self.setWindowTitle(title) self.icon_label = QLabel(self) self.icon_label.setPixmap( QPixmap(f'assets/{type_}.png').scaled(50, 50, Qt.KeepAspectRatio)) self.icon_label.setProperty("class", "icon") self.text_label = QLabel(text, self) self.text_label.setWordWrap(True) self.text_label.setProperty("class", "text") self.ok_button = Button("知道了", self) self.ok_button.clicked.connect(self.close) layout1 = QHBoxLayout() layout1.addWidget(self.icon_label, 1) layout1.addWidget(self.text_label, 4) layout = QVBoxLayout() layout.addLayout(layout1) layout.addWidget(self.ok_button) self.setLayout(layout) set_css(self, 'assets/dialog.css') self.exec()
def __init__(self): super().__init__() self.setObjectName("container") self.setWindowTitle("批量重命名工具") self.setWindowIcon(QIcon('assets/icon.png')) self.body_layout = QHBoxLayout() self.files_widget_list = [] self.all_chosen = False self.can_run = False self.is_running = False self.back_up = False from src.views.menu import Menu self.menubar = Menu(self) self.frame_head = QFrame(self) self.frame_body = QFrame(self) self.dialog_about = About(self) self.running = Running(self) self.body_table = QTableWidget(0, 4, self.frame_body) self.input_regx = QLineEdit(self.frame_head) self.input_regx.setPlaceholderText("输入正则表达式") self.out_regx = QLineEdit(self.frame_head) self.out_regx.setPlaceholderText("输出") self.set_layout() self.connect() self.set_class() set_css(self, "assets/container.css") self.show()
def __init__(self, body, container, dir_name='', base_name=''): super().__init__(body) self.setProperty("class", "body-file-row") self.body, self.container = body, container self.dir_name, self.base_name = dir_name, base_name self.input_name = parse_path(dir_name, base_name) self.output_name = parse_path(dir_name, base_name) self.chosen = False self.file_exist = False self.back_up_dir = '' self.choose_state_box = QCheckBox(self) self.choose_state_box.setFixedSize(20, 20) self.choose_state_box.setCursor(Qt.PointingHandCursor) self.choose_state_box.setProperty("class", "choose") self.choose_state_box.clicked.connect(self.__change_choose) self.input_label = QLabel( sub('([/\\\\])([^/\\\\]+)$', '\\1<a style="color: red">\\2</a>', self.input_name), self) self.input_label.setProperty("class", "input") self.output_label = QLabel(self.output_name, self) self.output_label.setProperty("class", "output") self.status_label = QLabel(self) self.status_label.setFixedSize(15, 15) self.status_label.setProperty("class", "status") set_css(self, 'assets/body_file_row.css')
def __init__(self, container): super().__init__(container) self.setObjectName("about") self.setWindowTitle("关于") self.container = container self.title_label = QLabel("一个批量重命名工具,仅此而已", self) self.url_to_git_label = QLabel("", self) self.set_layout() set_css(self, 'assets/about.css') self.hide()
def __init__(self, container: Container): super().__init__(container) self.container = container self.tab_file = QMenu('文件', self) self.tab_edit = QMenu('操作', self) self.tab_about = QAction('关于', self) self.action_choose_all = QAction('全选', self) self.action_delete_chosen = QAction('删除所选', self) self.action_do_it = QAction('执行所选', self) self.bind_action() self.set_element() set_css(self, 'assets/menu.css')
def __init__(self, text, parent): super().__init__(parent=parent, text=text) self.setProperty("class", "button") set_css(self, 'assets/button.css') self.setCursor(Qt.PointingHandCursor)