def new_footprint(self): dialog = NewFootprintDialog(self) if dialog.exec_() != QtGui.QDialog.Accepted: return (new_id, new_name, new_lib) = dialog.get_data() new_code = pycoffee.new_coffee(new_id, new_name) lib_dir = QtCore.QDir(self.coffee_lib[new_lib].directory) new_file_name = lib_dir.filePath("%s.coffee" % (new_id)) with open(new_file_name, 'w+') as f: f.write(new_code) self.parent.update_text(new_code) self.active_library = self.rescan_library(new_lib, new_id) self.active_footprint = self.active_library.meta_by_id(new_id) self.parent.show_footprint_tab() self.parent.status("%s/%s created." % (new_lib, new_name))
def new_footprint(self): dialog = NewFootprintDialog(self) if dialog.exec_() != QtGui.QDialog.Accepted: return (new_id, new_name, new_lib) = dialog.get_data() new_code = pycoffee.new_coffee(new_id, new_name) lib_dir = QtCore.QDir(self.lib_dir[new_lib]) new_file_name = lib_dir.filePath("%s.coffee" % (new_id)) with open(new_file_name, 'w+') as f: f.write(new_code) self.te1.setPlainText(new_code) self.rescan_library(new_lib, new_id) self.active_footprint_id = new_id self.active_library = new_lib self.show_footprint_tab() self.status("%s/%s created." % (new_lib, new_name))