def __init__(self, path: str, script_path: str = "", audio_dir: str = "", verbose: bool = False, is_sectioned: bool = False, audio_attached: bool = False, parent: Any = QCoreApplication.instance()): super(QAbstractItemModel, self).__init__(parent) self.tree: ET._ElementTree = parse(path) self.root: ET._Element = self.tree.getroot() self.file: str = path self.verbose = verbose self.script_path: str = script_path self.audio_dir: str = audio_dir self.is_sectioned: bool = is_sectioned self.audio_attached: bool = audio_attached self.title: str = "" self.res: Tuple[int, int] = (0, 0) #TODO make changeable? self.len, self.sect_len = 0, 0 self.sections: List[Section] = [] self.steps: List[List] = [] self.lsect: List[List] = [] self.lstep: List[List] = [] self.lstepprops: List[List] = [] try: self.loaded = self.load(path) except BaseException as exc: # logger.error("Demo failed to import. %s", str(exc)) self.loaded = False
def __init__(self, parent=None): super().__init__(parent=parent) btnRun1 = QPushButton(self) btnRun1.setStyleSheet('image:url(./img/1_img_kr.png);border:0px;') btnRun1.setGeometry(50, 50, 400, 400) btnRun1.clicked.connect(self.change_stack1) btnRun2 = QPushButton(self) btnRun2.setStyleSheet('image:url(./img/2_img_kr.png);border:0px;') btnRun2.setGeometry(500, 50, 400, 400) btnRun2.clicked.connect(self.change_stack2) exit_button = QPushButton(self) exit_button.setStyleSheet('image:url(./img/PNG_exit_2.png);border:0px;') exit_button.setGeometry(900, 0, 50, 50) exit_button.clicked.connect(QCoreApplication.instance().quit)
def exit(): """Выход из приложения.""" QCoreApplication.instance().quit()
def eventFilter(self, watched, event): if watched == QCoreApplication.instance(): if event.type() == QEvent.ApplicationFontChange: self.update() return QObject.eventFilter(watched, event)
def quit_me(self): QCoreApplication.instance().quit()