예제 #1
0
# -*- coding: utf-8 -*-
'''
Module Loader
@author: Anonymous Meerkat <*****@*****.**>
'''

import imp
import os
import collections
from relinux import config, logger


tn = logger.genTN("ModLoader")


# Checks if a folder is a module
def isModule(module):
    if (hasattr(module, "relinuxmodule") and hasattr(module, "relinuxmoduleapi") and
        module.relinuxmodule is True and hasattr(module, "run") and
            isinstance(getattr(module, "run"), collections.Callable)):
        return True
    return False


# Checks if a module is compatible with this version of relinux
def isCompatible(module):
    if module.relinuxmoduleapi != config.ModAPIVersion:
        logger.logI(tn, logger.W, _("Module") + " " + module.modulename + " " +
                    _("is incompatible with this relinux version") + " (" + _("relinux version:") + " " +
                    config.version + ", " + _("required version:") + " " + module.relinuxmoduleapi + ")")
        return False
예제 #2
0
파일: __main__.py 프로젝트: nazuk/relinux
def main():
    def parsePyHex(string1):
        string = "%x" % string1
        count = 0
        result = ""
        for char in string:
            if count == 0 or count == 2 or count == 4:
                result += char
                if count != 4:
                    result += "."
            elif count == 5:
                if char.lower() == "f":
                    break
                else:
                    result += char.lower()
            elif count == 6:
                result += char
            count += 1
        return result
    if not config.python_ok:
        print(_("Relinux only supports python ") + parsePyHex(config.min_python_version) + "-" +
              parsePyHex(config.max_python_version) + ", " + _("but python ") +
              parsePyHex(sys.hexversion) + " " + _("was used."))
        exitprog(1)
    from argparse import ArgumentParser
    '''tkname = "Tkinter"
    if config.python3:
        tkname = "tkinter"
    Tkinter = __import__(tkname)'''
    #import time
    from relinux import gui, configutils, logger, aptutil, modloader, utilities, fsutil
    config.Arch = fsutil.getArch()
    logger.veryverbose()
    config.GUIStream = utilities.eventStringIO()
    tn = logger.genTN("Main")
    parser = ArgumentParser(prog="relinux", usage="%(prog)s [options]")
    parser.add_argument("-V", "--version", action="store_true",
                        dest="showversion",
                        help="show version information")
    parser.add_argument("-q", "--quiet",
                        action="store_true", dest="quiet", default=False,
                        help="log as little as possible to stdout")
    parser.add_argument("-v", "--verbose",
                        action="store_true", dest="verbose", default=False,
                        help="log more to stdout")
    parser.add_argument("-vv", "--veryverbose",
                        action="store_true", dest="veryverbose", default=False,
                        help="log even more to stdout")
    parser.add_argument(
        "--no-stylesheet", action="store_true", dest="nostylesheet", default=False,
        help="don't use any stylesheets")
    args = parser.parse_args()
    config.EFiles.extend([config.GUIStream, sys.stdout])
    if args.showversion:
        version()
    if not args.quiet:
        config.IFiles.extend([config.GUIStream, sys.stdout])
    if args.verbose:
        config.VFiles.extend([config.GUIStream, sys.stdout])
    if args.veryverbose:
        config.VVFiles.extend([config.GUIStream, sys.stdout])
    #modules = []
    #aptcache = []
    #cbuffer = {}
    '''root = Tkinter.Tk()
    App = None
    def startProg(splash):
        global modules, aptcache, cbuffer, App
        spprogn = 6
        spprog = 0
        def calcPercent(def2 = (spprog, spprogn)):
            return utilities.calcPercent(*def2)
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Loading modules...")
        modules = []
        modulemetas = modloader.getModules()
        for i in modulemetas:
            modules.append(modloader.loadModule(i))
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Parsing configuration...")
        #buffer1 = utilities.getBuffer(open(relinuxdir + "/relinux.conf"))
        #buffer2 = configutils.compress(buffer1)
        #cbuffer = configutils.parseCompressedBuffer(buffer2, relinuxdir + "/relinux.conf")
        configfiles = [relinuxdir + "/relinux.conf"]
        for i in range(len(modulemetas)):
            for x in modules[i].moduleconfig:
                configfiles.append(
                    os.path.join(os.path.dirname(modulemetas[i]["path"]), x))
        cbuffer = configutils.parseFiles(configfiles)
        config.Configuration = cbuffer
        configutils.saveBuffer(config.Configuration)
        \'''for i in configutils.beautify(buffer1):
            print(i)\'''
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Reading APT Cache...")
        def aptupdate(op, percent):
            global minis
            if percent != None:
                minis += utilities.floatDivision(percent, 100)
            splash.setProgress(
                calcPercent((utilities.floatDivision(
                    minis + captop, aptops) + spprog, spprogn)),
                               "Reading APT Cache... (" + op + ")")
        def aptdone(op):
            global minis, captop
            minis = 0.0
            captop += 1
        aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, aptdone))
        config.AptCache = aptcache
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Loading the GUI...")
        App = gui.GUI(root)
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Filling in configuration...")
        App.fillConfiguration(cbuffer)
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Running modules...")
        for i in modules:
            modloader.runModule(i,
                                {"gui": App, "config": cbuffer, "aptcache": aptcache})
        spprog += 1
        splash.setProgress(calcPercent((spprog, spprogn)), "Launching relinux")
    splash = gui.Splash(root, startProg)
    #root.overrideredirect(Tkinter.TRUE) # Coming soon!
    root.mainloop()'''
    App = QtGui.QApplication(sys.argv)
    splash = QtGui.QSplashScreen(
        QtGui.QPixmap(relinuxdir + "/splash_light.png"))
    splash.show()
    App.processEvents()
    def showMessage(str_):
        splash.showMessage(
            str_ + "...", QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom)
        App.processEvents()
    showMessage(_("Loading modules"))
    modules = []
    modulemetas = modloader.getModules()
    for i in modulemetas:
        modules.append(modloader.loadModule(i))
    showMessage(_("Loading configuration files"))
    configfiles = [relinuxdir + "/relinux.conf"]
    for i in range(len(modulemetas)):
        for x in modules[i].moduleconfig:
            if "RELINUXCONFDIR" in os.environ:
                configfiles.append(os.path.join(relinuxdir, x))
            else:
                configfiles.append(
                    os.path.join(os.path.dirname(modulemetas[i]["path"]), x))
    cbuffer = configutils.parseFiles(configfiles)
    config.Configuration = cbuffer
    configutils.saveBuffer(config.Configuration)
    logfilename = configutils.getValue(cbuffer["Relinux"]["LOGFILE"])
    logfile = open(logfilename, "a")
    config.EFiles.append(logfile)
    config.IFiles.append(logfile)
    config.VFiles.append(logfile)
    config.VVFiles.append(logfile)
    logger.logI(tn, logger.I, "===========================")
    logger.logI(tn, logger.I, "=== Started new session ===")
    logger.logI(tn, logger.I, "===========================")
    showMessage(_("Loading APT cache 0%"))
    def aptupdate(op, percent):
        global minis
        if percent:
            minis = int(percent)
        showMessage(
            _("Loading APT cache") + " (" + op + ") " + str(minis) + "%")
    aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, None))
    config.AptCache = aptcache
    if not args.nostylesheet:
        showMessage(_("Loading stylesheet"))
        App.setStyleSheet(open(mainsrcdir + "/stylesheet.css", "r").read())
    showMessage(_("Loading GUI"))
    gui_ = gui.GUI(App)
    config.Gui = gui_
    showMessage(_("Running modules"))
    for i in modules:
            modloader.runModule(i, {})
    gui_.show()
    splash.finish(gui_)
    exitcode = App.exec_()
    config.ThreadStop = True
    logfile.close()
    sys.exit(exitcode)
예제 #3
0
def threadLoop(threads1_, **options):
    logger.logV(tn, logger.D, "Running thread loop")
    # Remove pointers
    threads1 = copy.deepcopy(threads1_)
    # Initialization
    threadsdone = []
    threadsrunning = []
    threadids = []
    threads = []
    pslock = None
    pelock = None
    if "poststart" in options:
        pslock = threading.RLock()
        if "postend" in options and options["postend"] == options["poststart"]:
            pelock = pslock
    logger.logVV(tn, logger.D, "Check poststart")
    if "postend" in options and pelock == None:
        pelock = threading.RLock()
    logger.logVV(tn, logger.D, "Check postend")
    # Remove duplicates
    for i in threads1:
        if not i in threads:
            threads.append(i)
    logger.logVV(tn, logger.D, "Check remduplicates")
    addOptional(threads)
    # Generate the threads
    for i in range(len(threads)):
        temp_ = threads[i]["thread"]
        kw = {"tn": logger.genTN(threads[i]["tn"])}
        if "threadargs" in options:
            for x in options["threadargs"].keys():
                kw[x] = options["threadargs"][x]
        temp = temp_(**kw)
        threads[i]["thread"] = temp
    logger.logVV(tn, logger.D, "Check genthreads")
    # Generate the thread IDS
    for i in range(len(threads)):
        threadids.append(i)
    logger.logVV(tn, logger.D, "Check genthreadids")
    # Make sure thread dependencies are made as IDs, and not actual thread dictionaries
    for i in range(len(threads)):
        for x in range(len(threads[i]["deps"])):
            if threads[i]["deps"][x] in threads:
                for y in range(len(threads)):
                    if threads[i]["deps"][x] == threads[y]:
                        threads[i]["deps"][x] = y
                        break
    logger.logVV(tn, logger.D, "Check threaddeps")
    # Actual loop
    def _ActualLoop(threads, threadsdone, threadsrunning, threadids):
        logger.logVV(tn, logger.D, "Check ActualLoop")
        #global threads, threadsdone, threadsrunning, threadids
        while config.ThreadStop is False:
            # Clear old threads
            for x in threadsrunning:
                checkThread(x, threadsdone, threadsrunning, threads, pelock, **options)
            # End if all threads are done
            if len(threadsdone) >= len(threads):
                logger.logVV(tn, logger.D, "Ending ActualLoop")
                break
            # Run runnable threads
            for x in findRunnableThreads(threadids, threadsdone, threadsrunning, threads, **options):
                runThread(x, threadsdone, threadsrunning, threads, pslock, **options)
            time.sleep(float(1.0 / config.ThreadRPS))
    # Make a new thread (so that the user can continue on using relinux)
    t = threading.Thread(target = _ActualLoop, args = (threads, threadsdone, threadsrunning, threadids))
    t.start()
예제 #4
0
    from tkinter import font as tkFont
    from tkinter import filedialog as tkFileDialog
else:
    import Tkinter
    import tkFileDialog
    import tkFont
    from PIL import Image, ImageTk
import time
import threading
import copy
import math
from relinux.__main__ import exitprog


threadname = "GUI"
tn = logger.genTN(threadname)
bg = "#383635"
#bg = "#fff"
#fg = "#000"
fg = "#fff"
lightbg = "#656260"
lightbghover = "#807b79"
lightbgclick = "#595655"
anims = True

normalc = (140, 200, 255)
hoverc = (255, 150, 150)
clickc = (255, 0, 0)


def _rgbtohex(rgb):
예제 #5
0
파일: gui.py 프로젝트: kokoye2007/relinux
# -*- coding: utf-8 -*-
'''
Everything GUI-related is here
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

import sys
from PyQt4 import QtGui, QtCore
from ui_mainwindow import Ui_MainWindow
from ui_welcome import Ui_Welcome
from relinux import config, configutils, logger

tn = logger.genTN("GUI")


def quitProg(app):
    sys.exit(app.exec_())


def saveFunc(var, val):
    if isinstance(val, QtCore.QString):
        val = str(val)
    config.Configuration[str(var[0])][str(var[1])][configutils.value] = val
    configutils.saveBuffer(config.Configuration)


class RelinuxSplash(QtGui.QSplashScreen):
    def __init__(self, *args):
        QtGui.QSplashScreen.__init__(self, *args)
        self.frameid = 0
        self.imageviewer = QtGui.QImageReader()
예제 #6
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(cpetcvar["tn"])
예제 #7
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(remcachedlists["tn"])
예제 #8
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(copykernel["tn"])
예제 #9
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(usbcomp["tn"])
예제 #10
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(pakmanifest["tn"])
예제 #11
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(genramdisk["tn"])
예제 #12
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(diskdefines["tn"])
예제 #13
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(copysyslinux["tn"])
예제 #14
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(copymemtest["tn"])
예제 #15
0
def main():
    def parsePyHex(string1):
        string = "%x" % string1
        count = 0
        result = ""
        for char in string:
            if count == 0 or count == 2 or count == 4:
                result += char
                if count != 4:
                    result += "."
            elif count == 5:
                if char.lower() == "f":
                    break
                else:
                    result += char.lower()
            elif count == 6:
                result += char
            count += 1
        return result

    if not config.python_ok:
        print(
            _("Relinux only supports python ") +
            parsePyHex(config.min_python_version) + "-" +
            parsePyHex(config.max_python_version) + ", " + _("but python ") +
            parsePyHex(sys.hexversion) + " " + _("was used."))
        exitprog(1)
    from argparse import ArgumentParser
    '''tkname = "Tkinter"
    if config.python3:
        tkname = "tkinter"
    Tkinter = __import__(tkname)'''
    #import time
    from relinux import gui, configutils, logger, aptutil, modloader, utilities, fsutil
    config.Arch = fsutil.getArch()
    logger.veryverbose()
    config.GUIStream = utilities.eventStringIO()
    tn = logger.genTN("Main")
    parser = ArgumentParser(prog="relinux", usage="%(prog)s [options]")
    parser.add_argument("-V",
                        "--version",
                        action="store_true",
                        dest="showversion",
                        help="show version information")
    parser.add_argument("-q",
                        "--quiet",
                        action="store_true",
                        dest="quiet",
                        default=False,
                        help="log as little as possible to stdout")
    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        dest="verbose",
                        default=False,
                        help="log more to stdout")
    parser.add_argument("-vv",
                        "--veryverbose",
                        action="store_true",
                        dest="veryverbose",
                        default=False,
                        help="log even more to stdout")
    parser.add_argument("--no-stylesheet",
                        action="store_true",
                        dest="nostylesheet",
                        default=False,
                        help="don't use any stylesheets")
    args = parser.parse_args()
    config.EFiles.extend([config.GUIStream, sys.stdout])
    if args.showversion:
        version()
    if not args.quiet:
        config.IFiles.extend([config.GUIStream, sys.stdout])
    if args.verbose:
        config.VFiles.extend([config.GUIStream, sys.stdout])
    if args.veryverbose:
        config.VVFiles.extend([config.GUIStream, sys.stdout])
    #modules = []
    #aptcache = []
    #cbuffer = {}
    '''root = Tkinter.Tk()
    App = None
    def startProg(splash):
        global modules, aptcache, cbuffer, App
        spprogn = 6
        spprog = 0
        def calcPercent(def2 = (spprog, spprogn)):
            return utilities.calcPercent(*def2)
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Loading modules...")
        modules = []
        modulemetas = modloader.getModules()
        for i in modulemetas:
            modules.append(modloader.loadModule(i))
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Parsing configuration...")
        #buffer1 = utilities.getBuffer(open(relinuxdir + "/relinux.conf"))
        #buffer2 = configutils.compress(buffer1)
        #cbuffer = configutils.parseCompressedBuffer(buffer2, relinuxdir + "/relinux.conf")
        configfiles = [relinuxdir + "/relinux.conf"]
        for i in range(len(modulemetas)):
            for x in modules[i].moduleconfig:
                configfiles.append(
                    os.path.join(os.path.dirname(modulemetas[i]["path"]), x))
        cbuffer = configutils.parseFiles(configfiles)
        config.Configuration = cbuffer
        configutils.saveBuffer(config.Configuration)
        \'''for i in configutils.beautify(buffer1):
            print(i)\'''
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Reading APT Cache...")
        def aptupdate(op, percent):
            global minis
            if percent != None:
                minis += utilities.floatDivision(percent, 100)
            splash.setProgress(
                calcPercent((utilities.floatDivision(
                    minis + captop, aptops) + spprog, spprogn)),
                               "Reading APT Cache... (" + op + ")")
        def aptdone(op):
            global minis, captop
            minis = 0.0
            captop += 1
        aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, aptdone))
        config.AptCache = aptcache
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Loading the GUI...")
        App = gui.GUI(root)
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Filling in configuration...")
        App.fillConfiguration(cbuffer)
        spprog += 1
        splash.setProgress(
            calcPercent((spprog, spprogn)), "Running modules...")
        for i in modules:
            modloader.runModule(i,
                                {"gui": App, "config": cbuffer, "aptcache": aptcache})
        spprog += 1
        splash.setProgress(calcPercent((spprog, spprogn)), "Launching relinux")
    splash = gui.Splash(root, startProg)
    #root.overrideredirect(Tkinter.TRUE) # Coming soon!
    root.mainloop()'''
    App = QtGui.QApplication(sys.argv)
    splash = QtGui.QSplashScreen(
        QtGui.QPixmap(relinuxdir + "/splash_light.png"))
    splash.show()
    App.processEvents()

    def showMessage(str_):
        splash.showMessage(str_ + "...",
                           QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom)
        App.processEvents()

    showMessage(_("Loading modules"))
    modules = []
    modulemetas = modloader.getModules()
    for i in modulemetas:
        modules.append(modloader.loadModule(i))
    showMessage(_("Loading configuration files"))
    configfiles = [relinuxdir + "/relinux.conf"]
    for i in range(len(modulemetas)):
        for x in modules[i].moduleconfig:
            if "RELINUXCONFDIR" in os.environ:
                configfiles.append(os.path.join(relinuxdir, x))
            else:
                configfiles.append(
                    os.path.join(os.path.dirname(modulemetas[i]["path"]), x))
    cbuffer = configutils.parseFiles(configfiles)
    config.Configuration = cbuffer
    configutils.saveBuffer(config.Configuration)
    logfilename = configutils.getValue(cbuffer["Relinux"]["LOGFILE"])
    logfile = open(logfilename, "a")
    config.EFiles.append(logfile)
    config.IFiles.append(logfile)
    config.VFiles.append(logfile)
    config.VVFiles.append(logfile)
    logger.logI(tn, logger.I, "===========================")
    logger.logI(tn, logger.I, "=== Started new session ===")
    logger.logI(tn, logger.I, "===========================")
    showMessage(_("Loading APT cache 0%"))

    def aptupdate(op, percent):
        global minis
        if percent:
            minis = int(percent)
        showMessage(
            _("Loading APT cache") + " (" + op + ") " + str(minis) + "%")

    aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, None))
    config.AptCache = aptcache
    if not args.nostylesheet:
        showMessage(_("Loading stylesheet"))
        App.setStyleSheet(open(mainsrcdir + "/stylesheet.css", "r").read())
    showMessage(_("Loading GUI"))
    gui_ = gui.GUI(App)
    config.Gui = gui_
    showMessage(_("Running modules"))
    for i in modules:
        modloader.runModule(i, {})
    gui_.show()
    splash.finish(gui_)
    exitcode = App.exec_()
    config.ThreadStop = True
    logfile.close()
    sys.exit(exitcode)
예제 #16
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(copypreseed["tn"])
예제 #17
0
파일: setup.py 프로젝트: Smile4ever/relinux
 def __init__(self):
     self.tn = logger.genTN(instdepends["tn"])
     self.depcache = aptutil.getDepCache(aptcache)
     self.ap = aptutil.getAcquireProgress()
     self.ip = aptutil.getInstallProgress()
예제 #18
0
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

from relinux import logger, config
import apt
import apt.progress


# Version Comparison Operations
lt = 0x00
le = 0x01
eq = 0x02
ge = 0x03
gt = 0x04

tn = logger.genTN("APT")


# OpProgress implementation
class OpProgress(apt.progress.base.OpProgress):
    def __init__(self, update, finish):
        apt.progress.base.OpProgress.__init__(self)
        self.old_op = ""
        self.updatefunc = update
        self.finishfunc = finish

    def update(self, percent=None):
        apt.progress.base.OpProgress.update(self, percent)
        op = self.op
        if self.major_change and self.old_op:
            op = self.old_op
예제 #19
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(remconfig["tn"])
예제 #20
0
Various APT Utilities
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

from relinux import logger, config
import apt
import apt.progress

# Version Comparison Operations
lt = 0x00
le = 0x01
eq = 0x02
ge = 0x03
gt = 0x04

tn = logger.genTN("APT")


# OpProgress implementation
class OpProgress(apt.progress.base.OpProgress):
    def __init__(self, update, finish):
        apt.progress.base.OpProgress.__init__(self)
        self.old_op = ""
        self.updatefunc = update
        self.finishfunc = finish

    def update(self, percent=None):
        apt.progress.base.OpProgress.update(self, percent)
        op = self.op
        if self.major_change and self.old_op:
            op = self.old_op
예제 #21
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(remtempvar["tn"])
예제 #22
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(genvarlogs["tn"])
예제 #23
0
파일: gui.py 프로젝트: KeithIMyers/relinux
# -*- coding: utf-8 -*-
'''
Everything GUI-related is here
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

import sys
from PyQt4 import QtGui, QtCore
from ui_mainwindow import Ui_MainWindow
from ui_welcome import Ui_Welcome
from relinux import config, configutils, logger


tn = logger.genTN("GUI")


def quitProg(app):
    sys.exit(app.exec_())


def saveFunc(var, val):
    if isinstance(val, QtCore.QString):
        val = str(val)
    config.Configuration[str(var[0])][str(var[1])][configutils.value] = val
    configutils.saveBuffer(config.Configuration)


class RelinuxSplash(QtGui.QSplashScreen):
    def __init__(self, *args):
        QtGui.QSplashScreen.__init__(self, *args)
        self.frameid = 0
예제 #24
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(remusers["tn"])
예제 #25
0
from PyQt4 import QtGui, QtCore
import os
import copy
import threading

relinuxmodule = True
relinuxmoduleapi = 1
modulename = "OSWeaver"
moduleconfig = ["osweaver.conf"]

# Just in case config.ISOTree doesn't include a /
isotreel = config.ISOTree + "/"
tmpsys = config.TempSys + "/"
aptcache = {}
page = {}
tn = logger.genTN(modulename)


def runThreads(threads, **options):
    threadmanager.threadLoop(threads, **options)


def run(adict):
    global aptcache, page
    configs = adict["config"]["OSWeaver"]
    isodir = configutils.getValue(configs[configutils.isodir])
    config.ISOTree = isodir + "/.ISO_STRUCTURE/"
    print(config.ISOTree)
    config.TempSys = isodir + "/.TMPSYS/"
    aptcache = adict["aptcache"]
    ourgui = adict["gui"]
예제 #26
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(casperconf["tn"])
예제 #27
0
# -*- coding: utf-8 -*-
'''
Thread Managing Class
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

from relinux import config, fsutil, logger, utilities
from PyQt4 import QtCore
import time
import threading
import copy


tn = logger.genTN("TheadManager")
cpumax = fsutil.getCPUCount() * 2


# Custom thread class
class Thread(QtCore.QThread):
    def __init__(self, **kw):
        QtCore.QThread.__init__(self)
        for i in kw:
            self.__dict__[i] = kw[i]

    def is_alive(self):
        return self.isRunning()

    def isAlive(self):
        return self.is_alive()

    def run(self):
예제 #28
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(tmpsystree["tn"])
예제 #29
0
from PyQt4 import QtGui, QtCore
import os
import copy
import threading

relinuxmodule = True
relinuxmoduleapi = 1
modulename = "OSWeaver"
moduleconfig = ["osweaver.conf"]

# Just in case config.ISOTree doesn't include a /
isotreel = config.ISOTree + "/"
tmpsys = config.TempSys + "/"
aptcache = {}
page = {}
tn = logger.genTN(modulename)


def runThreads(threads, **options):
    threadmanager.threadLoop(threads, **options)


def run(adict):
    global aptcache, page
    configs = adict["config"]["OSWeaver"]
    isodir = configutils.getValue(configs[configutils.isodir])
    config.ISOTree = isodir + "/.ISO_STRUCTURE/"
    print(config.ISOTree)
    config.TempSys = isodir + "/.TMPSYS/"
    aptcache = adict["aptcache"]
    ourgui = adict["gui"]
예제 #30
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.tn = logger.genTN(ubiquitysetup["tn"])
예제 #31
0
파일: setup.py 프로젝트: Smile4ever/relinux
 def __init__(self):
     self.tn = logger.genTN(instdepends["tn"])
     self.depcache = aptutil.getDepCache(aptcache)
     self.ap = aptutil.getAcquireProgress()
     self.ip = aptutil.getInstallProgress()
예제 #32
0
 def __init__(self):
     threading.Thread.__init__(self)
     self.deps = [tmpsystree]
     self.threadname = "TempSys"
     self.tn = logger.genTN(self.threadname)
예제 #33
0
    from tkinter import font as tkFont
    from tkinter import filedialog as tkFileDialog
else:
    import Tkinter
    import tkFileDialog
    import tkFont
    from PIL import Image, ImageTk
import time
import threading
import copy
import math
from relinux.__main__ import exitprog


threadname = "GUI"
tn = logger.genTN(threadname)
bg = "#383635"
# bg = "#fff"
# fg = "#000"
fg = "#fff"
lightbg = "#656260"
lightbghover = "#807b79"
lightbgclick = "#595655"
anims = True

normalc = (140, 200, 255)
hoverc = (255, 150, 150)
clickc = (255, 0, 0)


def _rgbtohex(rgb):
예제 #34
0
# -*- coding: utf-8 -*-
'''
Module Loader
@author: Joel Leclerc (MiJyn) <*****@*****.**>
'''

import imp
import os
import collections
from relinux import config, logger

tn = logger.genTN("ModLoader")


# Checks if a folder is a module
def isModule(module):
    if (hasattr(module, "relinuxmodule")
            and hasattr(module, "relinuxmoduleapi")
            and module.relinuxmodule is True and hasattr(module, "run")
            and isinstance(getattr(module, "run"), collections.Callable)):
        return True
    return False


# Checks if a module is compatible with this version of relinux
def isCompatible(module):
    if module.relinuxmoduleapi != config.ModAPIVersion:
        logger.logI(
            tn, logger.W,
            _("Module") + " " + module.modulename + " " +
            _("is incompatible with this relinux version") + " (" +