diff --git a/config/applet.py b/config/applet.py new file mode 100644 index 0000000..f302b55 --- /dev/null +++ b/config/applet.py @@ -0,0 +1,10 @@ +global oxiAppletLock +oxiAppletLock = threading.Lock() + +global oxiApplets +oxiApplets = [] + +global oxiApplet +class oxiApplet(object): + def __init__(self): + pass \ No newline at end of file diff --git a/config/appletCollection.py b/config/appletCollection.py new file mode 100644 index 0000000..8087336 --- /dev/null +++ b/config/appletCollection.py @@ -0,0 +1,11 @@ +global oxiAppletCollectionLock +oxiAppletCollectionLock = threading.Lock() + +global oxiAppletCollection +oxiAppletCollection = {} + +global oxiAppletCollectionRun +def oxiAppletCollectionRun(appletName): + with oxiAppletCollectionLock: + appletDefinition = oxiAppletCollection[appletName].copy() + appletDefinition[0](*appletDefinition[1],**appletDefinition[2]) \ No newline at end of file diff --git a/config/autorun.txt b/config/autorun.txt index 3c82b8a..d31e8d0 100644 --- a/config/autorun.txt +++ b/config/autorun.txt @@ -1 +1,5 @@ -helloworld.py # show a hello world message in terminal, as the simplest check \ No newline at end of file +helloworld.py # show a hello world message in terminal, as the simplest check +applet.py +appletCollection.py +qt.py +oxiver.py \ No newline at end of file diff --git a/config/oxiver.py b/config/oxiver.py new file mode 100644 index 0000000..c332977 --- /dev/null +++ b/config/oxiver.py @@ -0,0 +1,14 @@ +global platform +import platform +global QMainWindow +from qtpy.QtWidgets import QMainWindow +global QPixmap +from qtpy.QtGui import QPixmap +global QLabel +from qtpy.QtWidgets import QLabel +global QPushButton +from qtpy.QtWidgets import QPushButton +with oxiAppletCollectionLock: + oxiAppletCollection["oxiver"] = [oxiQtQueue.put,[[oxiRunScript,[oxiGetConfig("oxiver.qt.py")],{}]],{}] + +#oxiAppletCollectionRun("oxiver") \ No newline at end of file diff --git a/config/oxiver.qt.py b/config/oxiver.qt.py new file mode 100644 index 0000000..2bc053e --- /dev/null +++ b/config/oxiver.qt.py @@ -0,0 +1,45 @@ +class splashWindow(QMainWindow): + def __init__(self,applet,*args,**kwargs): + super().__init__(*args,**kwargs) + + with oxiAppletLock: + self.applet = applet + oxiApplets.append(self.applet) + self.applet.windows = [self] + + self.cTitle = "About " +oxiDistro + self.setWindowTitle(self.cTitle) + + self.cWidth = 414 + self.cHeight = 304 + self.resize(self.cWidth,self.cHeight) + + self.cCreateElements() + + def cCreateElements(self): + self.cImageLabel = QLabel(self) + self.cImageLabel.setPixmap(QPixmap(oxiGetConfig("splash.bmp"))) + self.cImageLabel.move(0,0) + self.cImageLabel.resize(414,78) + self.cText = QLabel(self) + + applets = 0 + with oxiAppletLock: applets = len(oxiApplets) + + self.cText.setText(oxiDistro + "\n" + "Version 0.0 (Build 0000)" + "\nLicensed under MIT, Copyright (C) 2022\n\n\noxi-applets running: " +str(applets)+ "\nOS: " +platform.system()+ " " +platform.release()+ "\nQt: " +str(QtCore.qVersion())) + self.cText.move(105,78 + 15) + self.cText.resize(414 - 105,304 - (78 + 15) - 31 - 15) + self.cText.setAlignment(QtCore.Qt.AlignLeft) + + self.cQuitButton = QPushButton("OK",self) + self.cQuitButton.clicked.connect(self.close) + self.cQuitButton.move(414 - 83,304 - 31) + self.cQuitButton.resize(75,23) + self.show() + + def closeEvent(self,event): + with oxiAppletLock: + oxiApplets.remove(self.applet) + +applet = oxiApplet() +splashWindow(applet) \ No newline at end of file diff --git a/config/qt.py b/config/qt.py new file mode 100644 index 0000000..22cd90f --- /dev/null +++ b/config/qt.py @@ -0,0 +1,63 @@ +def main(): + global threading + import threading + global queue + import queue + global qtpy + import qtpy + + global QApplication + from qtpy.QtWidgets import QApplication + global QtCore + import qtpy.QtCore as QtCore + global QThread + from qtpy.QtCore import QThread + global QObject + from qtpy.QtCore import QObject + + global oxiQtQueue + oxiQtQueue = queue.Queue() + + class qtThread(QThread): + #qt5: + cmd = QtCore.Signal(list) + + def __init__(self,*args,**kwargs): + super().__init__(*args,**kwargs) + + def run(self): + while True: + cmd = oxiQtQueue.get() + #qt4: + #self.emit(QtCore.SIGNAL("cmd"),cmd) + + #qt5: + self.cmd.emit(cmd) + + class qtApp(QApplication): + def __init__(self,readyQueue,*args,**kwargs): + super().__init__(*args,**kwargs) + self.queueThread = qtThread() + #qt4: + #self.queueThread.connect(self.queueThread,QtCore.SIGNAL("cmd"),self.queueCallback) + + #qt5: + self.queueThread.cmd.connect(self.queueCallback) + + self.queueThread.start() + readyQueue.put(True) + + def queueCallback(self,cmd): + cmd[0](*cmd[1],**cmd[2]) + + def close(self): + self.quit() + + readyQueue = queue.Queue() + global oxiQtApp + oxiQtApp = qtApp(readyQueue,sys.argv) + global oxiMainThreadQueue + oxiMainThreadQueue.put([oxiQtApp.exec_,[],{}]) + readyQueue.get() + print("Qt app running") +main() \ No newline at end of file diff --git a/config/splash.bmp b/config/splash.bmp new file mode 100644 index 0000000..56991f5 Binary files /dev/null and b/config/splash.bmp differ diff --git a/main.py b/main.py index 588dc96..2bdaf7e 100644 --- a/main.py +++ b/main.py @@ -1,22 +1,37 @@ -global oxiDistro -oxiDistro = "oxiDE" +def main(): + global oxiDistro + oxiDistro = "oxiDE" -global oxiMakeConfigPaths -def oxiMakeConfigPaths(): - global oxiConfigPaths - oxiConfigPaths = [] - if os.name == "nt": - oxiConfigPaths.append(p(os.environ["APPDATA"],oxiDistro)) - else: - oxiConfigPaths.append(p(os.environ["HOME"],".config",oxiDistro)) - oxiConfigPaths.append(p(sp,"config")) + global oxiMakeConfigPaths + def oxiMakeConfigPaths(): + global oxiConfigPaths + oxiConfigPaths = [] + if os.name == "nt": + oxiConfigPaths.append(p(os.environ["APPDATA"],oxiDistro)) + else: + oxiConfigPaths.append(p(os.environ["HOME"],".config",oxiDistro)) + oxiConfigPaths.append(p(sp,"config")) -global oxiGetConfig -def oxiGetConfig(file): - for cpath in oxiConfigPaths: - ffile = p(cpath,file) - if os.path.isfile(ffile): return ffile - return False - -oxiMakeConfigPaths() -oxiRunScript(oxiGetConfig("userMain.py")) \ No newline at end of file + global oxiGetConfig + def oxiGetConfig(file): + for cpath in oxiConfigPaths: + ffile = p(cpath,file) + if os.path.isfile(ffile): return ffile + return False + + global threading + import threading + global queue + import queue + + global oxiMainThreadQueue + oxiMainThreadQueue = queue.Queue() + + oxiMakeConfigPaths() + + threading.Thread(target=oxiRunScript,args=(oxiGetConfig("userMain.py"),)).run() + + while True: + cmd = oxiMainThreadQueue.get() + cmd[0](*cmd[1],**cmd[2]) +main() \ No newline at end of file diff --git a/oxiDE.py b/oxiDE.py index e6516e5..91dfb68 100644 --- a/oxiDE.py +++ b/oxiDE.py @@ -4,7 +4,7 @@ import sys oldexcepthook = sys.excepthook def newexcepthook(type,value,traceback): oldexcepthook(type,value,traceback) - input("Press ENTER to quit.") + #input("Press ENTER to quit.") sys.excepthook = newexcepthook import os