Fixed imports to allow usage of photobooth as script and module
This commit is contained in:
@@ -5,10 +5,10 @@ from time import time, sleep, localtime, strftime
|
||||
|
||||
from PIL import Image, ImageOps
|
||||
|
||||
from PictureList import PictureList
|
||||
from PictureDimensions import PictureDimensions
|
||||
from .PictureList import PictureList
|
||||
from .PictureDimensions import PictureDimensions
|
||||
|
||||
import gui
|
||||
from . import gui
|
||||
|
||||
class Photobooth:
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys, main
|
||||
|
||||
sys.exit(main.main(sys.argv))
|
||||
import sys, photobooth
|
||||
sys.exit(photobooth.main(sys.argv))
|
||||
|
||||
@@ -8,9 +8,9 @@ from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox, QFormLayout, QF
|
||||
from PyQt5.QtGui import QImage, QPainter, QPixmap
|
||||
|
||||
from . import *
|
||||
import camera, printer
|
||||
from .. import camera, printer
|
||||
|
||||
from printer.PrinterPyQt5 import PrinterPyQt5 as Printer
|
||||
from ..printer.PrinterPyQt5 import PrinterPyQt5 as Printer
|
||||
|
||||
class PyQt5Gui(Gui):
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ except DistributionNotFound:
|
||||
from multiprocessing import Pipe, Process
|
||||
import importlib
|
||||
|
||||
import camera, gui
|
||||
from Config import Config
|
||||
from Photobooth import Photobooth
|
||||
from . import camera, gui
|
||||
from .Config import Config
|
||||
from .Photobooth import Photobooth
|
||||
|
||||
|
||||
def lookup_and_import(module_list, name, package=None):
|
||||
@@ -22,9 +22,9 @@ def lookup_and_import(module_list, name, package=None):
|
||||
if name == config_name), None)
|
||||
|
||||
if package == None:
|
||||
import_module = importlib.import_module(result[0])
|
||||
import_module = importlib.import_module('photobooth.' + result[0])
|
||||
else:
|
||||
import_module = importlib.import_module('.' + result[0], package)
|
||||
import_module = importlib.import_module('photobooth.' + package + '.' + result[0])
|
||||
|
||||
if result[1] == None:
|
||||
return import_module
|
||||
|
||||
Reference in New Issue
Block a user