def _create_new_db(self, title=None, create_db=True, dbid=None): """ Create a new database, append to model """ new_path, title = self.create_new_db_cli(title, create_db, dbid) path_name = os.path.join(new_path, NAME_FILE) (tval, last) = time_val(new_path) node = self.model.append(None, [title, new_path, path_name, last, tval, False, ""]) self.selection.select_iter(node) path = self.model.get_path(node) self.name_renderer.set_property("editable", True) self.dblist.set_cursor(path, self.column, True) return new_path, title
def addfamtree(self, _): """ We add a family tree """ if self.__busy: return self.__busy = True print('User clicked on:', 'add fam tree') new_path, title = self.create_new_db_cli(None) path_name = os.path.join(new_path, NAME_FILE) (tval, last) = time_val(new_path) self.famtrees.append_famtree(FamTreeWrapper([title, new_path, path_name, last, tval, False, ''])) self.__busy = False
def _create_new_db(self, title=None, create_db=True, dbid=None): """ Create a new database, append to model """ new_path, title = self.create_new_db_cli(title, create_db, dbid) path_name = os.path.join(new_path, NAME_FILE) (tval, last) = time_val(new_path) node = self.model.append( None, [title, new_path, path_name, last, tval, False, '']) self.selection.select_iter(node) path = self.model.get_path(node) self.name_renderer.set_property('editable', True) self.dblist.set_cursor(path, self.column, True) return new_path, title
def __really_break_lock(self): """ Deletes the lock file associated with the selected database, then updates the display appropriately. """ try: self.break_lock(self.lock_file) store, node = self.selection.get_selected() dbpath = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8') (tval, last) = time_val(dbpath) store.set_value(node, OPEN_COL, 0) store.set_value(node, ICON_COL, "") store.set_value(node, DATE_COL, last) store.set_value(node, DSORT_COL, tval) except IOError: return
def __close_db(self, obj): """ Start the rename process by calling the start_editing option on the line with the cursor. """ store, node = self.selection.get_selected() dbpath = store.get_value(node, PATH_COL) (tval, last) = time_val(dbpath) store.set_value(node, OPEN_COL, 0) store.set_value(node, ICON_COL, "") # see bug_fix store.set_value(node, DATE_COL, last) store.set_value(node, DSORT_COL, tval) self.dbstate.no_database() self.__update_buttons(self.selection) if self.parent: self.parent.set_title("Gramps")
def __really_break_lock(self): """ Deletes the lock file associated with the selected database, then updates the display appropriately. """ try: self.break_lock(self.lock_file) store, node = self.selection.get_selected() dbpath = store.get_value(node, PATH_COL) (tval, last) = time_val(dbpath) store.set_value(node, OPEN_COL, 0) store.set_value(node, ICON_COL, "") # see bug_fix store.set_value(node, DATE_COL, last) store.set_value(node, DSORT_COL, tval) except IOError: return
def __close_db(self, obj): """ Close the database. Set the displayed line correctly, set the dbstate to no_database, update the sensitivity of the buttons in this dialogue box and get viewmanager to manage the main window and plugable views. """ store, node = self.selection.get_selected() dbpath = store.get_value(node, PATH_COL) (tval, last) = time_val(dbpath) store.set_value(node, OPEN_COL, 0) store.set_value(node, ICON_COL, "") # see bug_fix store.set_value(node, DATE_COL, last) store.set_value(node, DSORT_COL, tval) self.dbstate.no_database() self.__update_buttons(self.selection) self.viewmanager.post_close_db()