示例#1
0
'''
Quantitative ElectroLuminescence Analysis
'''
from fancytools.os.PathStr import PathStr

name = 'QELA'
__version__ = '-'  # time stamp, set by server during packaging
__author__ = 'Karl Bedrich'
__email__ = '*****@*****.**'
__license__ = 'GPLv3'

# MEDIA_PATH = PathStr.getcwd().join('client', 'media') #only works if
# executed from main dir
MEDIA_PATH = PathStr(__file__).dirname().join(
    'media')  # TODO: works in FROZEN?

ICON = MEDIA_PATH.join('logo.svg')
PATH = PathStr.home().mkdir(".%s" % name)
示例#2
0
import os
from fancytools.os.PathStr import PathStr

PATH = PathStr.home().join('.dataArtist')


def isRunning():
    return not PATH.join('executable_path.txt').isfile()


def start():
    with open(PATH.join('executable_path.txt'), 'r') as f:
        txt = f.read()
    os.spawnl(os.P_NOWAIT, *eval(txt))


def importFile(path):
    if not isRunning():
        start()
    t = PATH.join('import_files.txt')
    with open(t, 'a') as f:
        f.write(path + '\n')


if __name__ == '__main__':
    path = r'C:\Users\serkgb\.dataArtistUploader\demo\local\A03\8A\5_th_Round_2.tiff'
    importFile(path)
示例#3
0
'''
Quantitative ElectroLuminescence Analysis
'''
from fancytools.os.PathStr import PathStr

name = 'QELA'
__version__ = '-'  # time stamp, set by server during packaging
__author__ = 'Karl Bedrich'
__email__ = '*****@*****.**'
__license__ = 'GPLv3'

# MEDIA_PATH = PathStr.getcwd().join('client', 'media') #only works if
# executed from main dir
MEDIA_PATH = PathStr(__file__).dirname().join(
    'media')  # TODO: works in FROZEN?

ICON = MEDIA_PATH.join('logo.svg')
PATH = PathStr.home().mkdir(".dataArtistUploader")
示例#4
0
 def rootDir():
     try:
         return PathStr(
             open(CONFIG_FILE, 'r').read().decode('unicode-escape'))
     except IOError:  # create starter
         return PathStr.home()
示例#5
0
from fancywidgets.pyQtBased.Dialogs import Dialogs

# foreign
from qtpy import QtGui, QtWidgets, QtCore, QtSvg

# built-in
import os
from zipfile import ZipFile
import distutils
from distutils import spawn
import subprocess
import sys
import tempfile


CONFIG_FILE = PathStr.home().join(__name__)


class Launcher(QtWidgets.QMainWindow):
    """
    A graphical starter for *.pyz files created by the save-method from
    appbase.MainWindow

    NEEDS AN OVERHAUL ... after that's done it will be able to:

    * show all *.pyz-files in a filetree
    * show the session specific ...

        * icon
        * description
        * author etc.
示例#6
0
    def __init__(self, args, **kwargs):
        """
        Args:
            first_start_dialog (Optional[bool]):
                Show a different dialog for the first start.
            name (Optional[str]): The applications name.
            type (Optional[str]): The file type to be used for saving sessions.
            icon (Optional[str]): Path to the application icon.
        """

        QtCore.QObject.__init__(self)

        # SESSION CONSTANTS:
        self.NAME = kwargs.get('name', __main__.__name__)
        self.FTYPE = kwargs.get('ftype', 'pyz')
        self.ICON = kwargs.get('icon', None)
        # hidden app-preferences folder:
        self.dir = PathStr.home().mkdir('.%s' % self.NAME)
        self.APP_CONFIG_FILE = self.dir.join('config.txt')
        self._tmp_dir_session = None

        # session specific options:
        self.opts = _Opts({
            'maxSessions':         3,
            'enableGuiIcons':      True,
            'writeToShell':        True,
            'createLog':           False,
            'debugMode':           False,
            'autosave':            False,
            'autosaveIntervalMin': 15,
            'server':              False,
        }, self)
        # global options - same for all new and restored sessions:
        self.app_opts = {'showCloseDialog': True, 'recent sessions': []}

        if not self.APP_CONFIG_FILE.exists():
            # allow different first start dialog:
            dialog = kwargs.get('first_start_dialog', FirstStart)
            f = dialog(self)
            f.exec_()
            if not f.result():
                sys.exit()

            # create the config file
            with open(self.APP_CONFIG_FILE, 'w') as f:
                pass
        else:
            with open(self.APP_CONFIG_FILE, 'r') as f:
                r = f.read()
                if r:
                    self.app_opts.update(eval(r))

        self._icons_enabled = False
        self.log_file = None
        dirname = self.app_opts['recent sessions']
        if dirname:
            dirname = PathStr(dirname[-1]).dirname()
        self.dialogs = Dialogs(dirname)
        self.saveThread = _SaveThread()

        self._createdAutosaveFile = None
        self.tmp_dir_save_session = None
        # a work-dir for temp. storage:
#         self.tmp_dir_work = PathStr(tempfile.mkdtemp('%s_work' % self.NAME))

        pathName = self._inspectArguments(args)
        self.setSessionPath(pathName)
        if self.opts['createLog']:
            self._setupLogFile()
        # create connectable stdout and stderr signal:
        self.streamOut = StreamSignal('out')
        self.streamErr = StreamSignal('err')
        self._enableGuiIcons()
        # Auto-save timer:
        self.timerAutosave = QtCore.QTimer()
        self.timerAutosave.timeout.connect(self._autoSave)
        self.opts.activate()
        # first thing to do after start:
        QtCore.QTimer.singleShot(0, self.restoreCurrentState)