コード例 #1
0
    def __init__(self, subject, *args):
        """Set up a TASK child class environment.

        Initialise the Global Configuration, the Logger, the system load routines.
        Define a list of dependencies prerequisite to run this tasks.
        Define, create and aliases a Working directory for the tasks.

        If more arguments have been supplied to generic tasks, GenericTask will create an alias
        for each additionnal arg adding the suffix Dir to the name provided and then create  an alias 'dependDir'
        on the first optionnal arg provided to __init__

        """

        self.__order = None
        self.__name = self.__class__.__name__.lower()
        self.__cleanupBeforeImplement = True
        self.config = subject.getConfig()
        self.subjectDir = subject.getDir()
        self.toadDir = self.config.get('arguments', 'toadDir')
        self.workingDir = os.path.join(
            self.subjectDir,
            self.__class__.__module__.split(".")[-1])
        Logger.__init__(self, subject.getLogDir())
        Load.__init__(self, self.config.get('general', 'nthreads'))
        self.dependencies = []
        self.__dependenciesDirNames = {}
        for arg in args:
            self.dependencies.append(arg)
        for i, arg in enumerate(args):
            images = glob.glob("{}/tasks/??-{}.py".format(self.toadDir, arg))
            if len(images) == 1:
                [name, ext] = os.path.splitext(os.path.basename(images[0]))
                dir = os.path.join(self.subjectDir, name)
                setattr(self, "{}Dir".format(arg), dir)
                self.__dependenciesDirNames["{}Dir".format(arg)] = dir
                if i == 0:
                    self.dependDir = dir
コード例 #2
0
	def __init__(self):
		self.dirname = os.path.dirname(__file__)
		self.file_name = os.path.join(self.dirname, 'config.json')
		Load.__init__(self, self.file_name)
		self.data = self.__get()
コード例 #3
0
	def __get(self):
		config = Load(self.file_name).read_file()
		return config['config']
コード例 #4
0
# Import GUI Library (Tkinter)
from tkinter import Tk

# Import Built GUI Frames
from frame.intro import Intro
from frame.path import Path
from frame.license import License
from frame.controls import Controls

# Import Utility Scripts
from lib.load import Load

# Returns 'config.yml' as Python Dictionary
conf = Load('yaml')

# Instantiate and Configure Window (root)
root = Tk()
root.title(conf['root']['window']['title'])
root.config(menu=Load('menu', root))
root.geometry(
    str(conf['root']['window']['geometry']['width']) + 'x' +
    str(conf['root']['window']['geometry']['height']))
root.resizable(
    0, 0
) if not conf['root']['window']['geometry']['resizable'] else root.resizable(
    conf['root']['window']['geometry']['resizable']['width'],
    conf['root']['window']['geometry']['resizable']['height'])

# Pack Built GUI Frames Into 'root' Window
Intro(root).pack()
Path(root).pack()
コード例 #5
0
	def __init__(self):
		self.file_name = Config().get_data_json_path()
		Load.__init__(self, self.file_name)
		self.data = self.__get()
		self.base_url = Config().get_base_url()
		self.download_base_dir = Config().get_download_base_dir()
コード例 #6
0
	def __get(self):
		return Load(self.file_name).read_file()
コード例 #7
0
ファイル: intro.py プロジェクト: theshill/py-wizard-1
from tkinter import Frame, Label, Text, INSERT, DISABLED
from lib.load import Load
from lib.link import Link
import webbrowser

conf = Load('yaml')

if conf['root']['content']['intro']['link']:

    def open_link():
        webbrowser.open_new_tab(conf['root']['content']['intro']['link'])


def Intro(target):
    frame = Frame(target)

    title = Label(frame,
                  text='\n' + conf['root']['content']['intro']['title'],
                  font='Helvetica 18 bold')
    description = Text(frame,
                       borderwidth=0,
                       highlightthickness=0,
                       width=42,
                       height=2)

    title.pack()
    description.pack()
    hyperlink = Link(description)

    if ':' in conf['root']['content']['intro']['description']:
        for i in conf['root']['content']['intro']['description'].split(':'):