def save(self): os.mkdir(self.path) treepath = resource.getResource("resource:run.tree") runTree = common.parseTree(treepath, root=self.name) bctree = self.project._getBCTree() runTree.append(bctree) cm = configuration.ConfigurationManager(savespace=self.path) cm.getConfiguration("__wall__") def write(cm, originalconfid, confid): def isCellzoneSet(): l = [item[0] for item in self.cellzone] return confid in l def check(cellzonetype): if isCellzoneSet(): index = [item[0] for item in self.cellzone].index(confid) if self.cellzone[index][1]: return cellzonetype in self.cellzone[index][1] else: return None confdata = cm.getConfiguration(originalconfid) confdata['id'] = confid path = cm._getSavedFilePath(confid) quickidmap = {} for i in confdata['ITEMS']: quickidmap[i['quickid']] = "_".join([i['quickid'], confid]) for i in confdata['ITEMS']: if i['quickid'] == "por_zone" and check("Porous Zone"): i['value'] = True elif i['quickid'] == "rotating_zone" and check("Rotating Zone"): i['value'] = True i['quickid'] = quickidmap[i['quickid']] if 'hideon' in i: hideon = i['hideon'] for k,v in quickidmap.items(): hideon = hideon.replace(k, v) i['hideon'] = hideon print i['quickid'] cm._writeConfiguration(confdata, path) [write(cm, "__fluid__", fluidid) for fluidid in self.project._getBoundaries(self.project.pfluid)] [write(cm, "__wall__", wallid) for wallid in self.project._getBoundaries(self.project.pwall)] [write(cm, "__pressure_inlet__", prinlet) for prinlet in self.project._getBoundaries(self.project.pinlet)] treepath = os.path.join(self.path, "run.tree") common.writeTree(runTree, treepath) filepath = os.path.join(self.path, self.name) storage.save(self, filepath)
def _setupTree(self): self.projecticon = self._getIcon(resource.getResource("resource:project.png")) self.runicon = self._getIcon(resource.getResource("resource:run.png")) self.activerunicon = self._getIcon(resource.getResource("resource:activerun.png")) self.treeStore = self._createTreeStore(self.project) self.treeWidget = gtk.TreeView(self.treeStore) self.tvcolumn = gtk.TreeViewColumn("Project") self.treeWidget.append_column(self.tvcolumn) self.cellpb = gtk.CellRendererPixbuf() self.tvcolumn.pack_start(self.cellpb, False) self.tvcolumn.set_attributes(self.cellpb,pixbuf=0) self.cell = gtk.CellRendererText() self.tvcolumn.pack_start(self.cell, True) self.tvcolumn.set_attributes(self.cell,text=1) self.treeWidget.set_search_column(1) self.treeWidget.set_reorderable(False) self.treeWidget.connect("cursor-changed", self.activeNodeChanged) self.treeWidget.connect("button_press_event", self.mouseClick) self.treescroll.add(self.treeWidget)
def showAbout(parent=None): about = gtk.AboutDialog() parent = parent or tool.getToolWindow() print parent about.set_position(gtk.WIN_POS_CENTER_ON_PARENT) about.set_parent_window(parent) image = gtk.gdk.pixbuf_new_from_file(resource.getResource("resource:logo.xpm")) about.set_logo(image) quickui.setIcon(about) about.set_program_name("HiFUN") about.set_version("1.0") about.set_authors(["Nikhil Shende","Rohan W", "Vikrant Patil"]) about.set_website("http://www.sandi.co.in") about.run() about.destroy()
def setIcon(window): toolconf = ToolConf() icon = resource.getResource(toolconf.getIcon()) if icon: window.set_icon_from_file(icon)
def showToolOptions(): savespace = getConfSaveSpace() treepath = resource.getResource("resource:tooloptions.tree") optionTree = common.parseTree(treepath, root="Options") quickui.showConfigurationTree(title="Tool Options", tree=optionTree, parent=tool.getToolWindow(), savespace=savespace)
def _getIconPath(self, resourceid): return resource.getResource(resourceid)
def _getTemplate(self,template): template="resource:"+template respath=resource.getResource(template) return respath