def __init__(self, screen_size): super().__init__() self.save_path: str = None self.last_author: str = None self.last_comment: str = None self.last_location: str = None self.is_modified = False # init widget self.node_editor = MainNodeEditor(self) self.status_mouse_pos = QLabel("(x,y)") self.toolbar = self.addToolBar('Toolbar') self.history = self.node_editor.history # init attrs self.win_title = 'Karken: KMB' self.win_icon = QIcon(icon['WINICON']) # init common msg box self.pop_msg = PopMessageBox(self.win_title, self, run=True) self.save_msg = PopMessageBox(self.win_title, self) self.save_msg.make("What are you going to do with current project?", PopMessageBox.TYPE_SAVE_OR_NOT) self.close_msg = PopMessageBox(self.win_title, self) self.close_msg.make( "Project has been modified, do you want to save it?", PopMessageBox.TYPE_YES_OR_NO) # register actions in toolbar # ------ self.action_new = QAction(QIcon(icon['NEW']), '', self) self.action_open = QAction(QIcon(icon['OPEN']), '', self) self.action_import = QAction(QIcon(icon['IMPORT']), '', self) self.action_import.setEnabled(False) self.action_save = QAction(QIcon(icon['SAVE']), '', self) self.action_export = QAction(QIcon(icon['EXPORT']), '', self) # ------ self.action_select = QAction(QIcon(icon['ARROW']), '', self) self.action_hand = QAction(QIcon(icon['HAND']), '', self) self.action_undo = QAction(QIcon(icon['UNDO']), '', self) self.action_undo.setEnabled(False) self.action_redo = QAction(QIcon(icon['REDO']), '', self) self.action_redo.setEnabled(False) # ------ self.action_delete = QAction(QIcon(icon['DELETE']), '', self) self.action_edge_direct = QAction(QIcon(icon['SLINE']), '', self) self.action_edge_curve = QAction(QIcon(icon['CLINE']), '', self) self.action_note = QAction(QIcon(icon['NOTE']), '', self) # ------ self.action_search = QAction(QIcon(icon['SEARCH']), '', self) self.action_about = QAction(QIcon(icon['ABOUT']), '', self) self.set_toolbar_tooltip() self.set_toolbar_actions() self.set_toolbar_trigger() self.set_toolbar_style() # init status bar self.create_status_bar() # init main window self.init_ui(screen_size)
def __init__(self, fmt: int, *args, parent): super().__init__() self.fmt = fmt self.args = args self.parent = parent # msg box self.msg_ok = PopMessageBox('Export Success', run=True) self.msg_err = PopMessageBox('Export Error', run=True) self.msg_warn = PopMessageBox('Export Warning', run=True)
def check_integrity(self) -> (bool, QMessageBox): msg_box = PopMessageBox('Warning', self) msg = 'Please assign the {} of this module.' state = True # model name if not self.name.text(): msg_box.make(msg.format('name')) state = False else: self.model_name = self.name.text().replace(' ', '_') # model author if not self.author.text(): msg_box.make(msg.format('author')) state = False else: self.model_author = self.author.text() # model comment optional if self.comments.toPlainText(): self.model_comment = self.comments.toPlainText() # export location if not self.dst_loc: msg_box.make(msg.format('location')) state = False return state, msg_box
def __init__(self, graphic_scene, status_bar_msg, parent=None): super().__init__(parent) self.gr_scene = graphic_scene self.status_bar_msg = status_bar_msg self.sidebar = KMBViewSideBar(self) self.search_bar = SearchBarThread(self) self.parent = parent self.del_items_msg = PopMessageBox('Delete items', self) self.mode = MOUSE_SELECT self.edge_type = None # signals from sidebar. self.disable_wheel = False self.has_pressed_zoom_btn = False # signals from right menu. self.has_chosen_from_rm = False self.has_chosen_to_del_from_rm = False # signals from note. self.has_finished_editing = True # current dynamic variables. self.last_scene_mouse_pos = None self.current_node_item_name = None self.current_node_item_type = None self.current_node_item_sort = None # optional self.current_node_pin_args = None self.current_node_pin_id = None # record group selected items. self.rubber_select = [] self.zoom_in_factor = 1.25 self.zoom = 10 self.zoom_step = 1 self.zoom_range = (0, 8) self.zoom_clamp = True self.init_ui() self.init_slots()
def __init__(self, src: str, editor): super().__init__() self.loader = Loader(src) self.editor = editor self.msg_err = PopMessageBox('Open Error', run=True)