From 17c8a6703a8093d31c6772ba3b8d9ee01adaa0da Mon Sep 17 00:00:00 2001
From: tassaron
Date: Sat, 15 Jul 2017 18:59:22 -0400
Subject: trying to make setup.py work
---
src/__init__.py | 0
src/__main__.py | 3 +++
src/main.py | 29 ++++++++++++++++-------------
src/presetmanager.py | 1 -
src/preview_thread.py | 1 -
src/video_thread.py | 1 -
6 files changed, 19 insertions(+), 16 deletions(-)
create mode 100644 src/__init__.py
create mode 100644 src/__main__.py
(limited to 'src')
diff --git a/src/__init__.py b/src/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/__main__.py b/src/__main__.py
new file mode 100644
index 0000000..a68739e
--- /dev/null
+++ b/src/__main__.py
@@ -0,0 +1,3 @@
+from avpython.main import main
+
+main()
\ No newline at end of file
diff --git a/src/main.py b/src/main.py
index 2216d2a..317237c 100644
--- a/src/main.py
+++ b/src/main.py
@@ -2,12 +2,18 @@ from PyQt5 import uic, QtWidgets
import sys
import os
-import core
-import preview_thread
-import video_thread
+def main():
+ if getattr(sys, 'frozen', False):
+ # frozen
+ wd = os.path.dirname(sys.executable)
+ else:
+ # unfrozen
+ wd = os.path.dirname(os.path.realpath(__file__))
+
+ # make local imports work everywhere
+ sys.path.append(wd)
-if __name__ == "__main__":
mode = 'GUI'
if len(sys.argv) > 2:
mode = 'commandline'
@@ -28,22 +34,15 @@ if __name__ == "__main__":
# app.setOrganizationName("audio-visualizer")
if mode == 'commandline':
- from command import *
+ from command import Command
main = Command()
elif mode == 'GUI':
- from mainwindow import *
+ from mainwindow import MainWindow
import atexit
import signal
- if getattr(sys, 'frozen', False):
- # frozen
- wd = os.path.dirname(sys.executable)
- else:
- # unfrozen
- wd = os.path.dirname(os.path.realpath(__file__))
-
window = uic.loadUi(os.path.join(wd, "mainwindow.ui"))
# window.adjustSize()
desc = QtWidgets.QDesktopWidget()
@@ -64,3 +63,7 @@ if __name__ == "__main__":
# applicable to both modes
sys.exit(app.exec_())
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/presetmanager.py b/src/presetmanager.py
index 0028203..6e003a1 100644
--- a/src/presetmanager.py
+++ b/src/presetmanager.py
@@ -6,7 +6,6 @@ from PyQt5 import QtCore, QtWidgets
import string
import os
-import core
import toolkit
diff --git a/src/preview_thread.py b/src/preview_thread.py
index 4ffb7f6..6c33aff 100644
--- a/src/preview_thread.py
+++ b/src/preview_thread.py
@@ -6,7 +6,6 @@ from PyQt5 import QtCore, QtGui, uic
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PIL import Image
from PIL.ImageQt import ImageQt
-import core
from queue import Queue, Empty
import os
diff --git a/src/video_thread.py b/src/video_thread.py
index 674765a..60db99f 100644
--- a/src/video_thread.py
+++ b/src/video_thread.py
@@ -18,7 +18,6 @@ from threading import Thread, Event
import time
import signal
-import core
from toolkit import openPipe
from frame import Checkerboard
--
cgit v1.2.3
g
| Commit message (Expand) | Author | Files | Lines |