Пример #1
0
 def loadUi(self, parent=None):
     if issubclass(self.__class__, QtGui.QWizard) :
         return
     try:
         path = Path(sys.modules[self.__module__].__file__)
     except:
         path = Path(apiUtils.getMainDir())
     
     if path :
         ui_file = path.dir().join('views','{0}.ui'.format(self.__class__.__name__))
         if ui_file.exists() :
             self = loadUi(ui_file, parent, self, self.customWidgets())
         else:
             print 'Unable to load ui file | {0}'.format(ui_file)
Пример #2
0
    def loadUi(self, parent=None):
        if issubclass(self.__class__, QtGui.QWizard):
            return
        try:
            path = Path(sys.modules[self.__module__].__file__)
        except:
            path = Path(apiUtils.getMainDir())

        if path:
            ui_file = path.dir().join('views',
                                      '{0}.ui'.format(self.__class__.__name__))
            if ui_file.exists():
                self = loadUi(ui_file, parent, self, self.customWidgets())
            else:
                print('Unable to load ui file | {0}'.format(ui_file))
Пример #3
0
def runFile( filepath, basePath=None, cmd=None, debug=False ):
    """
    Runs the filepath in a shell with proper commands given, or passes 
    the command to the shell. (CMD in windows) the current platform

    :param filepath: path to the file to execute
    :param basePath: working directory where the command should be called
    from.  If omitted, the current working directory is used.

    """
    status = False
    filepath = Path(filepath)

    # make sure the filepath we're running is a file 
    if not filepath.isfile():
        return status

    # determine the base path for the system
    if basePath is None:
        basePath = filepath.dir()

    options = { 'filepath': filepath, 'basepath': basePath }

    if cmd == None :
        if filepath.ext in ['.py','.pyw']:
            if debug:
                cmd = 'python.exe "{0}"'.format(filepath)
            else:
                cmd = 'pythonw.exe "{0}"'.format(filepath)

            status = subprocess.Popen( cmd, stdout=sys.stdout, stderr=sys.stderr, shell=debug, cwd=basePath)

    if not status :
        try:
            status = os.startfile(filepath)
        except:
            print('runFile cannot run type (*{0})'.format(filepath.ext))

    return status
Пример #4
0
def runFile( filepath, basePath=None, cmd=None, debug=False ):
    """
    Runs the filepath in a shell with proper commands given, or passes 
    the command to the shell. (CMD in windows) the current platform

    :param filepath: path to the file to execute
    :param basePath: working directory where the command should be called
    from.  If omitted, the current working directory is used.

    """
    status = False
    filepath = Path(filepath)

    # make sure the filepath we're running is a file 
    if not filepath.isfile():
        return status

    # determine the base path for the system
    if basePath is None:
        basePath = filepath.dir()

    options = { 'filepath': filepath, 'basepath': basePath }

    if cmd == None :
        if filepath.ext in ['.py','.pyw']:
            if debug:
                cmd = 'python.exe "{0}"'.format(filepath)
            else:
                cmd = 'pythonw.exe "{0}"'.format(filepath)

            status = subprocess.Popen( cmd, stdout=sys.stdout, stderr=sys.stderr, shell=debug, cwd=basePath)

    if not status :
        try:
            status = os.startfile(filepath)
        except:
            print 'runFile cannot run type (*{0})'.format(filepath.ext)

    return status
Пример #5
0
 def openPath(self):
     userInputPath = Path(str(self.ui_Field.text()))
     if userInputPath:
         subprocess.call('explorer ' + userInputPath.dir().caseSensative())
Пример #6
0
 def openPath(self):
     userInputPath = Path(str(self.ui_Field.text()))
     if userInputPath :
         subprocess.call('explorer ' + userInputPath.dir().caseSensative())