Beispiel #1
0
 def newFolder(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "folder", "newfolder",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create folder %s" % dlg.rname)
         if utils.createDirectory(os.path.dirname(dlg.rname),
                                  os.path.basename(dlg.rname)):
             self.parent.showMessage("New folder %s created" % dlg.rname)
         else:
             self.parent.showMessage("Can't create %s" % dlg.rname)
Beispiel #2
0
 def newFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "file", "newfile",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create file %s" % dlg.rname)
         if utils.createFile(os.path.dirname(dlg.rname),
                             os.path.basename(dlg.rname)):
             self.parent.showMessage("New file %s created" % dlg.rname)
             self.openFile(dlg.rname, "text")
         else:
             self.parent.showMessage("Can't create %s" % dlg.rname)
Beispiel #3
0
 def newSQLFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "SQL file", "new.sql",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create SQL %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             sql = "resources/templates/newfiles/new.sql"
             utils.copyFile(pkg_resources.resource_filename(__name__, sql),
                            dlg.rname)
             self.parent.showMessage("New SQL %s created" % dlg.rname)
         else:
             self.parent.showMessage("SQL %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "sql")
Beispiel #4
0
 def newQtUIFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "Qt UI file", "new.ui",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create UI %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             ui = "resources/templates/newfiles/new.ui"
             utils.copyFile(pkg_resources.resource_filename(__name__, ui),
                            dlg.rname)
             self.parent.showMessage("New Qt UI %s created" % dlg.rname)
         else:
             self.parent.showMessage("Qt UI %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "xml")
Beispiel #5
0
 def newMDFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "MarkDown file",
                               "new.md", self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create Markdown %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             md = "resources/templates/newfiles/new.md"
             utils.copyFile(pkg_resources.resource_filename(__name__, md),
                            dlg.rname)
             self.parent.showMessage("New Markdown %s created" % dlg.rname)
         else:
             self.parent.showMessage("Markdown %s already exists" %
                                     dlg.rname)
         self.openFile(dlg.rname, "md")
Beispiel #6
0
 def newModule(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "module", "new.py",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create module %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             module = "resources/templates/newfiles/new.py"
             utils.copyFile(
                 pkg_resources.resource_filename(__name__, module),
                 dlg.rname)
             self.parent.showMessage("New module %s created" % dlg.rname)
         else:
             self.parent.showMessage("Module %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "python")