Skip to content

Commit

Permalink
Updated file/folder structure. Fixed issue where closing from the sys…
Browse files Browse the repository at this point in the history
…tray icon wouldn't actually close the program.
  • Loading branch information
samclane committed Sep 17, 2018
1 parent 22b049c commit 4a26e50
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions _constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "1.5.1"
BUILD_DATE = "2018-09-15T13:18:39.248598"
VERSION = "1.5.2"
BUILD_DATE = "2018-09-17T12:50:39.163864"
AUTHOR = "Sawyer McLane"
DEBUGGING = False
DEBUGGING = True
4 changes: 2 additions & 2 deletions debug.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import datetime

bd = datetime.datetime.now().isoformat()
auth = "Sawyer McLane"
vers = "1.5.1"
vers = "1.5.2"
is_debug = True

# Write version info into _constants.py resource file
Expand All @@ -26,7 +26,7 @@ with open('default.ini', 'w') as f:
block_cipher = None


a = Analysis(['gui.pyw', 'color_thread.py', 'audio.py', 'settings.py', 'SysTrayIcon.py', 'utils.py', '_constants.py', 'splashscreen.py'],
a = Analysis(['gui.pyw', 'utilities//color_thread.py', 'utilities//audio.py', 'ui//settings.py', 'ui//SysTrayIcon.py', 'utilities//utils.py', '_constants.py', 'ui//splashscreen.py'],
pathex=['\\.'],
binaries=[],
datas=[],
Expand Down
4 changes: 2 additions & 2 deletions default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ defaultmonitor = get_primary_monitor()

# Used for diagnostic purposes. Please do not change.
[Info]
version = 1.5.1
version = 1.5.2
author = Sawyer McLane
builddate = 2018-09-15T13:18:39.248598
builddate = 2018-09-17T12:50:39.163864
6 changes: 3 additions & 3 deletions demo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import datetime

bd = datetime.datetime.now().isoformat()
auth = "Sawyer McLane"
vers = "1.5.1"
vers = "1.5.2"
is_debug = True

# Write version info into _constants.py resource file
Expand All @@ -13,7 +13,7 @@ with open('_constants.py', 'w') as f:
f.write("AUTHOR = \"{}\"\n".format(auth))
f.write("DEBUGGING = {}".format(str(is_debug)))

# Write version info into default config file
# Write version info into default config file/
with open('default.ini', 'r') as f:
initdata = f.readlines()
initdata[-1] = "builddate = {}\n".format(bd)
Expand All @@ -25,7 +25,7 @@ with open('default.ini', 'w') as f:
block_cipher = None


a = Analysis(['dummy_devices.py', 'gui.pyw', 'color_thread.py', 'audio.py', 'settings.py', 'SysTrayIcon.py', 'utils.py', '_constants.py', 'splashscreen.py'],
a = Analysis(['tests//dummy_devices.py', 'gui.pyw', 'utilities//color_thread.py', 'utilities//audio.py', 'ui//settings.py', 'ui//SysTrayIcon.py', 'utilities//utils.py', '_constants.py', 'ui//splashscreen.py'],
pathex=['\\.'],
binaries=[],
datas=[],
Expand Down
21 changes: 11 additions & 10 deletions gui.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ from PIL import Image as pImage
from lifxlan import *
from lifxlan import errors

import SysTrayIcon
import audio
import color_thread
import settings
from ui import SysTrayIcon, settings
from utilities import audio, color_thread
from _constants import *
from colorscale import ColorScale
from keypress import Keystroke_Watcher
from settings import config
from splashscreen import Splash
from utils import *
from ui.colorscale import ColorScale
from utilities.keypress import Keystroke_Watcher
from ui.settings import config
from ui.splashscreen import Splash
from utilities.utils import *

HEARTBEAT_RATE = 3000 # 3 seconds
LOGFILE = 'lifx-control-panel.log'
Expand Down Expand Up @@ -144,9 +142,12 @@ class LifxFrame(ttk.Frame):
# Setup tray icon
tray_options = (('Adjust Lights', None, lambda *_: self.master.deiconify()),)

def lambda_factory(self):
return lambda *_: self.on_closing()

def run_tray_icon():
SysTrayIcon.SysTrayIcon(resource_path('res/icon_vector_9fv_icon.ico'), "LIFX-Control-Panel", tray_options,
on_quit=lambda *_: self.on_closing)
on_quit=lambda_factory(self))

self.systray_thread = threading.Thread(target=run_tray_icon, daemon=True)
self.systray_thread.start()
Expand Down
4 changes: 2 additions & 2 deletions main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import datetime

bd = datetime.datetime.now().isoformat()
auth = "Sawyer McLane"
vers = "1.5.1"
vers = "1.5.2"
is_debug = False

# Write version info into _constants.py resource file
Expand All @@ -26,7 +26,7 @@ with open('default.ini', 'w') as f:
block_cipher = None


a = Analysis(['gui.pyw', 'color_thread.py', 'audio.py', 'settings.py', 'SysTrayIcon.py', 'utils.py', '_constants.py', 'splashscreen.py'],
a = Analysis(['gui.pyw', 'utilities//color_thread.py', 'utilities//audio.py', 'ui//settings.py', 'ui//SysTrayIcon.py', 'utilities//utils.py', '_constants.py', 'ui//splashscreen.py'],
pathex=['\\.'],
binaries=[],
datas=[],
Expand Down
2 changes: 1 addition & 1 deletion dummy_devices.py → tests/dummy_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lifxlan import product_map, Group

from gui import Color as DummyColor
from utils import resource_path
from utilities.utils import resource_path


LOGFILE = 'lifx-control-panel.log'
Expand Down
2 changes: 1 addition & 1 deletion tests.py → tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from dummy_devices import *
from tests.dummy_devices import *
from gui import Color
import random
import string
Expand Down
File renamed without changes.
Empty file added ui/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion colorscale.py → ui/colorscale.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tkinter as tk

from utils import tuple2hex, HueToRGB, KelvinToRGB
from utilities.utils import tuple2hex, HueToRGB, KelvinToRGB


class ColorScale(tk.Canvas):
Expand Down
4 changes: 2 additions & 2 deletions settings.py → ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from lifxlan import *
from lifxlan.utils import RGBtoHSBK

from utils import resource_path
from keypress import Keystroke_Watcher
from utilities.utils import resource_path
from utilities.keypress import Keystroke_Watcher
from _constants import *

config = configparser.ConfigParser()
Expand Down
File renamed without changes.
Empty file added utilities/__init__.py
Empty file.
File renamed without changes.
5 changes: 2 additions & 3 deletions color_thread.py → utilities/color_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

from PIL import Image
from desktopmagic.screengrab_win32 import *
from lifxlan import LifxLAN, utils
from lifxlan import utils

from utils import get_primary_monitor
from settings import config
from ui.settings import config


def avg_screen_color(initial_color):
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4a26e50

Please sign in to comment.