def initHelpEngine(self): self.helpRootUrl = 'qthelp://com.trolltech.qt.%d%d%d/qdoc/' % QtCore.__version_info__ # Store help collection file in cache dir of assistant. cacheDir = QtGui.QDesktopServices.storageLocation( QtGui.QDesktopServices.DataLocation) + '/Trolltech/Assistant/' helpDataFile = 'qtdemo_%s.qhc' % QtCore.__version__ dir = QtCore.QDir() if not dir.exists(cacheDir): dir.mkpath(cacheDir) # Create help engine (and new helpDataFile if it does not exist). self.helpEngine = QtHelp.QHelpEngineCore(cacheDir + helpDataFile) self.helpEngine.setupData() qtDocRoot = QtCore.QLibraryInfo.location( QtCore.QLibraryInfo.DocumentationPath) + '/qch' qtDocRoot = QtCore.QDir(qtDocRoot).absolutePath() qchFiles = ['/qt.qch', '/designer.qch', '/linguist.qch'] oldDir = self.helpEngine.customValue('docDir', '') if oldDir != qtDocRoot: for qchFile in qchFiles: self.helpEngine.unregisterDocumentation( QtHelp.QHelpEngineCore.namespaceName(qtDocRoot + qchFile)) # If the data that the engine will work on is not yet registered, do it # now. for qchFile in qchFiles: self.helpEngine.registerDocumentation(qtDocRoot + qchFile) self.helpEngine.setCustomValue('docDir', qtDocRoot)
def __init__(self): super(MenuManager, self).__init__() self.contentsDoc = None self.assistantProcess = QtCore.QProcess() self.helpRootUrl = '' self.docDir = QtCore.QDir() self.imgDir = QtCore.QDir() self.info = {} self.window = None self.ticker = None self.tickerInAnim = None self.upButton = None self.downButton = None self.helpEngine = None self.score = Score() self.currentMenu = "[no menu visible]" self.currentCategory = "[no category visible]" self.currentMenuButtons = "[no menu buttons visible]" self.currentInfo = "[no info visible]" self.currentMenuCode = -1 self.readXmlDocument() self.initHelpEngine()
def initialize_libraries(self, settings): def load_libraries(): size = settings.beginReadArray('library') for i in range(size): settings.setArrayIndex(i) name = settings.value('name') filen = settings.value('file') library = coffee.library.Library(name, filen) self.coffee_lib[name] = library settings.endArray() if not 'library' in settings.childGroups(): if sys.platform == 'darwin': # TODO: retest and modify under darwin example_lib = QtCore.QDir('share/madparts/examples').absolutePath() else: data_dir = os.environ['DATA_DIR'] example_lib = QtCore.QDir(os.path.join(data_dir, 'examples')).absolutePath() library = coffee.library.Library('Examples', example_lib) self.coffee_lib = { 'Examples': library } self.save_libraries(settings) else: self.coffee_lib = {} load_libraries()
def setup(self): self.initHelpEngine() self.documentationDir = QtCore.QDir( QtCore.QLibraryInfo.location( QtCore.QLibraryInfo.DocumentationPath)) self.imagesDir = QtCore.QDir(self.documentationDir) if self.documentationDir.cd("html") and self.documentationDir.cd( "images"): self.imagesDir.setPath(self.documentationDir.path()) self.documentationDir.cdUp() else: QtGui.QMessageBox.warning( self, self.tr("No Documentation Found"), self.tr("I could not find the Qt documentation.")) self.maximumLabels = 0 self.demosDir = QtCore.QDir("./../../demos") demoCategories = self.readInfo(":/demos.xml", self.demosDir) self.examplesDir = QtCore.QDir("./../../") exampleCategories = self.readInfo(":/examples.xml", self.examplesDir) if demoCategories + exampleCategories <= 0: QtGui.QMessageBox.warning(self, self.tr("No Examples or Demos found"), self.tr("I could not find any PyQt examples or demos.\n"\ "Please ensure that PyQt is installed correctly."), QtGui.QMessageBox.Cancel, QtGui.QMessageBox.NoButton) return False self.maximumLabels = max(demoCategories + exampleCategories, self.maximumLabels) for category in self.categories: self.maximumLabels = max( len(self.categories[category]['examples']) + 1, self.maximumLabels) mainDescription = self.categories['[main]']['description'] if len(mainDescription) > 0: mainDescription += self.tr("\n") self.categories['[main]']['description'] = mainDescription + self.tr( "<p>Press <b>Escape</b>, <b>Backspace</b>, or <b>%1</b> to " "return to a previous menu.</p>" "<p>Press <b>%2</b> to switch between normal and full screen " "modes.</p>" "<p>Use <b>%3</b> to exit the launcher.</p>") \ .arg(QtCore.QString(QtGui.QKeySequence(self.tr("Alt+Left")))) \ .arg(QtCore.QString(QtGui.QKeySequence(self.tr("Ctrl+F")))) \ .arg(QtCore.QString(QtGui.QKeySequence(self.tr("Ctrl+Q")))) self.emit(QtCore.SIGNAL("showPage()")) return True
def populate(self, path): self.parent = QtCore.QDir() self.parent.cd(path) dir = QtCore.QDir(self.parent) entries = dir.entryList() for entry in entries: if not (entry == '..' and os.path.normpath(path) == '/Volumes') and not entry == '.': self.addWidget( thumbwidgetitem(os.path.join(path, entry), parentwindow=self.parentwindow))
def populate(self, path): self.parent = QtCore.QDir() self.parent.cd(path) dir = QtCore.QDir(self.parent) entries = dir.entryList() for entry in entries: # print fileinfo.fileName() if not (entry == '..' and os.path.normpath(path) == pipeline.pathtools.getRoot()) and not entry == '.': self.addWidget(thumbwidgetitem(os.path.join(path,entry), parentwindow=self.parentwindow))
def emptyDir(dirName, deleteThisDir=True, filesToKeep=[]): """ Vidage récursif d'un dossier. Si deleteThisDir est mis à False, le dossier lui-même n'est pas supprimé. filesToKeep est une liste de noms de fichiers à ne pas effacer (filesToKeep=['.htaccess'] par exemple). """ has_err = False aDir = QtCore.QDir(dirName) if aDir.exists(): entries = aDir.entryInfoList(QtCore.QDir.NoDotAndDotDot | QtCore.QDir.Dirs | QtCore.QDir.Files | QtCore.QDir.Hidden) for entryInfo in entries: path = entryInfo.absoluteFilePath() if entryInfo.isDir(): # on fait suivre filesToKeep, mais deleteThisDir sera True : has_err = emptyDir(path, filesToKeep=filesToKeep) elif entryInfo.isFile(): if not(entryInfo.fileName() in filesToKeep): f = QtCore.QFile(path) if f.exists(): if not(f.remove()): print("PB: ", path) has_err = True if deleteThisDir: if not(aDir.rmdir(aDir.absolutePath())): print("Erreur de suppression de : " + aDir.absolutePath()) has_err = True return has_err
def dataDariFolder(self): folder = QtGui.QFileDialog.getExistingDirectory( self, "Tentukan Folder", QtCore.QDir.currentPath()) f = folder if folder: folder = QtCore.QDir(folder) file = folder.entryList(QtCore.QDir.Files | QtCore.QDir.NoSymLinks) ada = False for i in file: tipe = QtCore.QFileInfo(f + i).suffix() if tipe.lower() == 'mp3': self.masukanFile([f + "/" + i, f]) ada = True if ada == False: QtGui.QMessageBox( QtGui.QMessageBox.Critical, "Gagal Menambah Musik", "File Musik tidak ditemukan pada folder :" + f + "" "Silahkan pilih folder yang berisi file MP3.").exec_() elif self.sedangDiputar == False: pass self.putarMusik() self.perintahStop()
def populate(self, path): self.parent = QtCore.QDir() self.parent.cd(path) dir = QtCore.QDir(self.parent) entries = dir.entryList() for entry in entries: # print fileinfo.fileName() if not (entry == '..' and os.path.normpath(path) == pipeline.pathtools.getRoot()) and not entry == '.': nameoverride = entry if entry == '..' else None w = thumbwidgetitem(os.path.join(path, entry), parentwindow=self.parentwindow, nameoverride=nameoverride) self.addWidget(w) w.sigOpenFile.connect(self.sigOpenFile) w.sigChangeRoot.connect(self.chdir)
def move_footprint(self): old_code = self.parent.code_textedit.toPlainText() old_meta = pycoffee.eval_coffee_meta(old_code) dialog = MoveFootprintDialog(self, old_meta) if dialog.exec_() != QtGui.QDialog.Accepted: return (new_name, new_lib) = dialog.get_data() old_name = old_meta['name'] my_id = self.active_footprint.id fn = my_id + '.coffee' old_lib = self.active_library new_code = old_code.replace("#name %s" % (old_name), "#name %s" % (new_name)) new_lib_dir = QtCore.QDir(self.coffee_lib[new_lib].directory) new_file_name = new_lib_dir.filePath(fn) with open(new_file_name, 'w+') as f: f.write(new_code) status_str = "moved %s/%s to %s/%s." % (old_lib.name, old_name, new_lib, new_name) self.parent.status(status_str) if old_lib.name == new_lib: self.rescan_library(old_lib.name, my_id) # just to update the nameq else: full_fn = os.path.join(old_lib.directory, fn) os.unlink(full_fn) self.rescan_library(old_lib.name) self.active_library = self.rescan_library(new_lib, my_id)
def findQmFiles(self): trans_dir = QtCore.QDir("./translations") fileNames = trans_dir.entryList(["*.qm"], QtCore.QDir.Files, QtCore.QDir.Name) fileNames = [trans_dir.filePath(p) for p in fileNames] return fileNames
def setCurrentDirPath(self , path ): self.path = path self.directorylist.clear() self.listfile.clear() self.listseq.clear() self.pathChanged.emit( path ) directory = QtCore.QDir(path) files = list(directory.entryList(QtCore.QDir.AllDirs)) for fn in files: if fn == ".": continue self.addItem(fn ,FileSequenceWidget.FOLDER) files = [e for e in os.listdir(path) if os.path.isfile(os.path.join(path, e))] if self._splitSequence == False: sequences, others = file_seq.find(path) for s in sequences: self.addItem(str(s), FileSequenceWidget.SEQUENCE) self.listseq[str(s)] = s for o in others: self.addItem(o , FileSequenceWidget.FILE) else: files = [e for e in os.listdir(path) if os.path.isfile(os.path.join(path, e))] for fn in files: self.addItem(fn ,FileSequenceWidget.FILE)
def selectfile(self, number): itemSelected = self.listfile.currentIndex().data() if itemSelected in self.listseq3 : pass else: self.listseq3.append(itemSelected) path = QtCore.QDir.currentPath() self.fileSelected.emit(os.path.join( self.path , itemSelected)) directory = QtCore.QDir(os.path.join(path,'sequenceFileSelector')) self.listseq2 = list(directory.entryList(QtCore.QDir.AllEntries)) for i in range(len(self.listseq2)): ic = self.listseq2[i] c = ic.split(".") for d in self.listseq3: e = d.split(".") if str(c[0]) == str(e[0]): if ic in self.listseq4 : pass else: print 'append' print ic self.listseq4.append(ic) files = [e for e in os.listdir(path) if os.path.isfile(os.path.join(path, e))]
def setId(self, elem, parent=None): global idList pattern = r"name(\d+)$" if elem.text: result = re.findall(pattern, elem.text, re.S|re.M) if result: elem.text = re.sub(r"name\d+$", "", elem.text, flags=re.S|re.M) anchor = etree.Element("a", {"name":result[0]}) elem.insert(0, anchor) anchor.tail = elem.text elem.text = "" idList.append(result[0]) if elem.tail: result = re.findall(pattern, elem.tail, re.S|re.M) if result: elem.tail = re.sub(r"name\d+$", "", elem.tail, flags=re.S|re.M) anchor = etree.Element("a", {"name":result[0]}) parent.insert(0, anchor) anchor.tail = parent.text parent.text = "" idList.append(result[0]) if elem.tag == "img": if QtCore.QDir(elem.attrib["src"]).isRelative(): elem.attrib["src"] = QtCore.QDir.currentPath()+"/"+elem.attrib["src"] if len(list(elem))>0: for child in list(elem): self.setId(child, elem)
def getOption(self): option = {} if self.timeOption1_RadioButton.isChecked(): start, end = abcUtils.getFrameRange() option['startFrame'] = str(start) option['endFrame'] = str(end) else: option['startFrame'] = str(self.startFrame_LineEdit.text()) option['endFrame'] = str(self.endFrame_LineEdit.text()) option['timeUnit'] = str(self.timeUnit_ComboBox.currentText()) if str(self.directory_LineEdit.text()).find("\\") == -1: option['directory'] = str(self.directory_LineEdit.text()) else: winStyleDir = str(self.directory_LineEdit.text()) cacheDir = winStyleDir.replace("\\", "/") option['directory'] = cacheDir if self.directory_LineEdit.text(): directory = QtCore.QDir(self.directory_LineEdit.text()) if QtCore.QDir.exists(directory): return option else: warningMessage = QtGui.QMessageBox(self) warningMessage.setText( 'Path does not exist. \nPlease check the path.') warningMessage.setIcon(QtGui.QMessageBox.Critical) warningMessage.exec_() else: warningMessage = QtGui.QMessageBox(self) warningMessage.setText('Please set the path.') warningMessage.setIcon(QtGui.QMessageBox.Warning) warningMessage.exec_()
def load_svg_patterns(): """Load the default Draft SVG patterns and user defined patterns. The SVG patterns are added as a dictionary to the `App.svgpatterns` attribute. """ import importSVG App.svgpatterns = {} # Getting default patterns in the resource file patfiles = QtCore.QDir(":/patterns").entryList() for fn in patfiles: file = ":/patterns/" + str(fn) f = QtCore.QFile(file) f.open(QtCore.QIODevice.ReadOnly) p = importSVG.getContents(str(f.readAll()), 'pattern', True) if p: for k in p: p[k] = [p[k], file] App.svgpatterns.update(p) # Get patterns in a user defined file altpat = getParam("patternFile", "") if os.path.isdir(altpat): for f in os.listdir(altpat): if f[-4:].upper() == ".SVG": file = os.path.join(altpat, f) p = importSVG.getContents(file, 'pattern') if p: for k in p: p[k] = [p[k], file] App.svgpatterns.update(p)
def import_footprints(self): dialog = ImportFootprintsDialog(self) if dialog.exec_() != QtGui.QDialog.Accepted: return (footprint_names, importer, selected_library) = dialog.get_data() lib_dir = QtCore.QDir(self.explorer.coffee_lib[selected_library].directory) l = [] for footprint_name in footprint_names: interim = inter.import_footprint(importer, footprint_name) l.append((footprint_name, interim)) cl = [] for (footprint_name, interim) in l: try: coffee = generatesimple.generate_coffee(interim) cl.append((footprint_name, coffee)) except Exception as ex: tb = traceback.format_exc() s = "warning: skipping footprint %s\nerror: %s" % (footprint_name, str(ex) + '\n' + tb) QtGui.QMessageBox.warning(self, "warning", s) for (footprint_name, coffee) in cl: meta = pycoffee.eval_coffee_meta(coffee) new_file_name = lib_dir.filePath("%s.coffee" % (meta['id'])) with open(new_file_name, 'w+') as f: f.write(coffee) self.explorer.rescan_library(selected_library) self.status('Importing done.')
def set_root(self, path): """ Update the widget to use a different root path """ self.root = QtCore.QDir(path) self.remove_directories(0) self.open_directory(self.root)
def test_directory_list(qtbot): fpath = os.path.join(os.path.dirname(__file__), "testdir") widget = cdatgui.bases.DirectoryListWidget(QtCore.QDir(fpath), filetypes=["test"]) qtbot.addWidget(widget) # it properly sets the name of the directory assert widget.name() == "testdir" # it only has the items in the directory (no . or ..) assert len(widget.entries) == 3 assert widget.entries[0].fileName() == "filter_test.test" assert widget.entries[0].isFile() assert widget.entries[1].fileName() == "subfile.txt" assert widget.entries[1].isFile() assert widget.entries[2].fileName() == "subfolder" assert widget.entries[2].isDir() # filetypes works correctly assert widget.list.item(0).flags() != 0 # should be enabled assert widget.list.item(1).flags() == 0 # should be disabled # has_item works assert widget.has_item(widget.list.item(0)) with qtbot.waitSignal(widget.currentItemChanged, timeout=1000, raising=True): widget.list.setCurrentRow(0)
def import_footprint(self, initial=False): dialog = gui.dialogs.ImportFootprintsDialog(self) if dialog.exec_() != QtGui.QDialog.Accepted: return None (footprint_names, importer, lib_filename) = dialog.get_data() (lib_name, _ext) = os.path.splitext(os.path.basename(lib_filename)) lib_dir = QtCore.QDir(".") footprint_name = footprint_names[0] print "doing footprint:", footprint_name interim = inter.import_footprint(importer, footprint_name) try: coffee = generatesimple.generate_coffee(interim) except Exception as ex: tb = traceback.format_exc() s = "warning: skipping footprint %s\nerror: %s" % ( footprint_name, str(ex) + '\n' + tb) QtGui.QMessageBox.warning(self, "warning", s) return None meta = pycoffee.eval_coffee_meta(coffee) new_file_name = lib_dir.filePath("%s_%s.coffee" % (lib_name, meta['name'])) with open(new_file_name, 'w+') as f: f.write(coffee) self.status('Importing done.') if not initial: self.file_name = new_file_name self.readonly = not os.access(self.file_name, os.W_OK) with open(self.file_name) as f: self.update_text(f.read()) self.set_code_textedit_readonly(self.readonly) self.update_title() else: return new_file_name
def open(self): path = QtCore.QDir.currentPath( ) if self.filename_path == None else QtCore.QDir.absolutePath( QtCore.QDir(self.filename_path)) filename, _ = QtGui.QFileDialog.getOpenFileName( self, "Open File", path) if filename: self.loadImage(filename)
def saveGraph(self, saveAs): """Wraps the performSave method. Opens a dialog for user to save the file if the lastFileName attribute is not set or if the saveas argument is True. Otherwise it overwrites the file which was opened. Arguments: saveAs (bool): Whether to save the graph to a different file path. """ self.timeLine.pause() filePath = self.lastFileName if len(filePath) == 0 or saveAs: lastPresetFolder = str( self.settings.value("mainWindow/lastPresetFolder")) if len(self.lastFileName) > 0: filePath = self.lastFileName if filePath.lower().endswith('.canvas'): filePath = filePath[0:-7] else: filePath = lastPresetFolder filePath, _ = QtGui.QFileDialog.getSaveFileName( self, "Save graph", filePath, "*.canvas") if len(filePath) == 0: return False if filePath.lower().endswith(".canvas.canvas"): filePath = filePath[0:-7] elif not filePath.lower().endswith(".canvas"): filePath += ".canvas" folder = QtCore.QDir(filePath) folder.cdUp() self.settings.setValue("mainWindow/lastPresetFolder", folder.path()) binding = self.dfgWidget.getDFGController().getBinding() if not self.performSave(binding, filePath): if self.dfgWidget: self.dfgWidget.getDFGController().log( "ERROR: failed to save graph, unable to open file.") return False if self.dfgWidget: self.dfgWidget.getDFGController().log("graph saved.") self.lastFileName = filePath self.onFileNameChanged(filePath) self.lastSavedBindingVersion = binding.getVersion() self.setCurrentFile(filePath) return True
def main(): sys.path.append(os.path.join(os.getcwd(), 'lib/python2.7/lib-dynload')) # set QApplication working dir, so that relative paths resolve properly across different install types try: d = QtCore.QDir(__file__) d.cdUp() d.cdUp() d.setCurrent(d.path()) print 'QApp root:', QtCore.QDir().current() except NameError: print 'Could not set QApp root.' # Hopefully this is run as an executable, and this is unnecessary anyway for path in sys.path: print 'path:', path import xicam # IMPORTANT! DO NOT REMOVE! Xicam must be loaded early to avoid graphical bugs on mac (?!) app = QtGui.QApplication(sys.argv) pixmap = QtGui.QPixmap("xicam/gui/splash.gif") print 'CWD:', os.getcwd() if True: # Disable to bypass splashscreen for testing on windows splash = SplashScreen(pixmap, f=QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.SplashScreen) splash.setAttribute(QtCore.Qt.WA_DeleteOnClose) splash.setMask(pixmap.mask()) splash.show() splash.raise_() splash.activateWindow() app.setActiveWindow(splash) else: import xicam from xicam import xglobals xglobals.window = xicam.xicamwindow.MyMainWindow(app) xglobals.window.ui.show() xglobals.window.ui.raise_() xglobals.window.ui.activateWindow() app.setActiveWindow(xglobals.window.ui) app.processEvents() sys.exit(app.exec_())
def createTempAppDir(): """ (re)création du dossier temporaire on cree un sous-dossier /tmp/PROGNAME à améliorer avec tests sous windob """ tempDir = QtCore.QDir.temp() emptyDir(QtCore.QDir.tempPath() + "/" + PROGNAME) tempDir.rmdir(PROGNAME) tempAppDir = QtCore.QDir(QtCore.QDir.tempPath() + "/" + PROGNAME + "/") if tempAppDir.exists(): tempAppPath = tempAppDir.path() elif tempDir.mkdir(PROGNAME): tempAppPath = QtCore.QDir(QtCore.QDir.tempPath() + "/" + PROGNAME + "/").path() else: utils.myPrint("tempAppDir sera temp") tempAppPath = QtCore.QDir.tempPath() return tempAppPath
def treerefresh(self, path=None): """ Refresh the file tree, or switch directories and refresh """ if path is None: path = self.filetreepath root = QtCore.QDir(path) self.filetreemodel.setRootPath(root.absolutePath()) self.filetree.setRootIndex( self.filetreemodel.index(root.absolutePath())) self.filetree.show() return
def remove_footprint(self): directory = self.active_library.directory fn = self.active_footprint.filename QtCore.QDir(directory).remove(fn) # fall back to first_foot in library, if any library = self.rescan_library(self.active_library.name) if library.select_first_foot(): self.active_footprint = library.first_foot_meta self.active_library = library.coffee_lib # else fall back to any first foot... else: root = self.model.invisibleRootItem() for row_index in range(0, root.rowCount()): library = root.child(row_index) if library.select_first_foot(): self.active_footprint_id = library.first_foot.id self.active_library = library directory = self.active_library.directory fn = self.active_footprint.id + '.coffee' ffn = QtCore.QDir(directory).filePath(fn) with open(ffn) as f: self.parent.update_text(f.read())
def initHelpEngine(self): self.helpRootUrl = QtCore.QString( "qthelp://com.trolltech.qt.%d%d%d/qdoc/" % (QtCore.QT_VERSION >> 16, ((QtCore.QT_VERSION >> 8) & 0xff), (QtCore.QT_VERSION & 0xff))) # Store help collection file in cache dir of assistant. cacheDir = QtGui.QDesktopServices.storageLocation( QtGui.QDesktopServices.DataLocation) + "/Trolltech/Assistant" helpDataFile = "qtdemo_%s.qhc" % QtCore.QT_VERSION_STR dir = QtCore.QDir() if not dir.exists(cacheDir): dir.mkpath(cacheDir) # Create the help engine (and a new helpDataFile if it does not exist). self.helpEngine = QtHelp.QHelpEngineCore(cacheDir + helpDataFile) self.helpEngine.setupData() qtDocRoot = QtCore.QLibraryInfo.location( QtCore.QLibraryInfo.DocumentationPath) + "/qch" qtDocRoot = QtCore.QDir(qtDocRoot).absolutePath() qchFiles = ["/qt.qch", "/designer.qch", "/linguist.qch"] oldDir = self.helpEngine.customValue("docDir", QtCore.QVariant( QtCore.QString())).toString() if oldDir != qtDocRoot: for qchFile in qchFiles: self.helpEngine.unregisterDocumentation( QtHelp.QHelpEngineCore.namespaceName(qtDocRoot + qchFile)) # If the data that the engine will work on is not yet registered, do it # now. for qchFile in qchFiles: self.helpEngine.registerDocumentation(qtDocRoot + qchFile) self.helpEngine.setCustomValue("docDir", QtCore.QVariant(qtDocRoot))
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 refresh(self, path=None): """ Refresh the file tree, or switch directories and refresh """ if path is None: path = self.path else: self.path = path root = QtCore.QDir(path) self.file_model.setRootPath(root.absolutePath()) self.setRootIndex(self.file_model.index(root.absolutePath())) self.pathChanged.emit(path) config.settings['defaultlocalpath'] = path
def setWorkspace(self, path): absPath = QDir(path).absolutePath() absSampleDir = QDir(self.sampleDir).absolutePath() if absPath == absSampleDir: QtGui.QMessageBox.warning(self, u"피니엔진", u"샘플 폴더는 작업폴더로 지정할 수 없습니다.") self.findWorkspace() return QtCore.QDir().mkpath(path) Settings()["workspace"] = path self.workspace.setText(path) self.loadingWorkspace(path)