Skip to content

Commit

Permalink
Pre-release of all changes to this point. Includes final zero bar err…
Browse files Browse the repository at this point in the history
…or fix.
  • Loading branch information
DaveL17 committed Nov 3, 2020
1 parent 390aa19 commit 8b540a5
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 258 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 DaveL17
Copyright (c) 2020 DaveL17

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions _changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.8.38
- Pre-release of all changes to this point. Includes final zero bar error fix.

v0.8.37
- Adds feature to force leading and trailing bars with zero values to be
plotted (to overcome matplotlib bug).
Expand Down
2 changes: 1 addition & 1 deletion matplotlib.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.8.37</string>
<string>0.8.38</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@
"""

import ast
try:
import indigo
except ImportError:
pass
import logging
import operator as op
import os
import platform
import sys
import traceback

try:
import indigo
except ImportError:
pass

__author__ = "DaveL17"
__build__ = "Unused"
__copyright__ = "Copyright 2017-2020 DaveL17"
__license__ = "MIT"
__title__ = "DLFramework"
__version__ = "0.1.02"
__version__ = "0.1.04"


class Fogbert(object):
Expand All @@ -33,8 +35,8 @@ def __init__(self, plugin):
self.plugin.debugLog(u"Initializing DLFramework...")
self.pluginPrefs = plugin.pluginPrefs

fmt = '%(asctime)s.%(msecs)03d\t%(levelname)-10s\t%(name)s.%(funcName)-28s %(msg)s'
self.plugin.plugin_file_handler.setFormatter(logging.Formatter(fmt, datefmt='%Y-%m-%d %H:%M:%S'))
log_format = '%(asctime)s.%(msecs)03d\t%(levelname)-10s\t%(name)s.%(funcName)-28s %(msg)s'
self.plugin.plugin_file_handler.setFormatter(logging.Formatter(fmt=log_format, datefmt='%Y-%m-%d %H:%M:%S'))

def pluginEnvironment(self):
"""
Expand Down Expand Up @@ -79,6 +81,30 @@ def pluginEnvironmentLogger(self):
self.plugin.logger.info(u"{0:<31} {1}".format("Process ID:", os.getpid()))
self.plugin.logger.info(u"{0:{1}^135}".format("", "="))

# =============================================================================
def pluginErrorHandler(self, sub_error):
"""
Centralized handling of traceback messages
Centralized handling of traceback messages formatted for pretty display in the
plugin log file. If sent here, they will not be displayed in the Indigo Events
log. Use the following syntax to send exceptions here::
self.pluginErrorHandler(traceback.format_exc())
-----
:param traceback object sub_error:
"""

sub_error = sub_error.splitlines()
self.plugin.logger.critical(u"{0:!^80}".format(" TRACEBACK "))

for line in sub_error:
self.plugin.logger.critical(u"!!! {0}".format(line))

self.plugin.logger.critical(u"!" * 80)

def convertDebugLevel(self, debug_val):
"""
The convertDebugLevel method is used to standardize the various implementations
Expand All @@ -99,26 +125,26 @@ def convertDebugLevel(self, debug_val):

return debug_val

def deviceList(self, filter=None):
def deviceList(self, dev_filter=None):
"""
Returns a list of tuples containing Indigo devices for use in
config dialogs (etc.)
:return: [(ID, "Name"), (ID, "Name")]
"""
devices_list = [('None', 'None')]
[devices_list.append((dev.id, dev.name)) for dev in indigo.devices.iter(filter)]
[devices_list.append((dev.id, dev.name)) for dev in indigo.devices.iter(dev_filter)]
return devices_list

def deviceListEnabled(self, filter=None):
def deviceListEnabled(self, dev_filter=None):
"""
Returns a list of tuples containing Indigo devices for use in
config dialogs (etc.) Returns enabled devices only.
:return: [(ID, "Name"), (ID, "Name")]
"""
devices_list = [('None', 'None')]
[devices_list.append((dev.id, dev.name)) for dev in indigo.devices.iter(filter) if dev.enabled]
[devices_list.append((dev.id, dev.name)) for dev in indigo.devices.iter(dev_filter) if dev.enabled]
return devices_list

def variableList(self):
Expand Down Expand Up @@ -146,21 +172,21 @@ def deviceAndVariableList(self):
devices_and_variables_list.append(('None', 'None'),)
return devices_and_variables_list

def launchWebPage(self, url):
def launchWebPage(self, launch_url):
"""
The launchWebPage method is used to direct a call to the registered
default browser and open the page referenced by the parameter 'URL'.
"""
import webbrowser

webbrowser.open(url)
webbrowser.open(url=launch_url)

def generatorStateOrValue(self, id):
def generatorStateOrValue(self, dev_id):
"""The generatorStateOrValue() method returns a list to populate the relevant
device states or variable value to populate a menu control."""

try:
id_number = int(id)
id_number = int(dev_id)

if id_number in indigo.devices.keys():
state_list = [(state, state) for state in indigo.devices[id_number].states if not state.endswith('.ui')]
Expand All @@ -181,6 +207,15 @@ def audit_server_version(self, min_ver):
if ver[0] < min_ver:
self.plugin.stopPlugin(u"This plugin requires Indigo version {0} or above.".format(min_ver), isError=True)

def audit_os_version(self, min_ver):

# =========================== Audit Operating System Version ============================
ver = platform.mac_ver()[0].split('.')

if int(ver[1]) < min_ver:
self.plugin.stopPlugin(u"This plugin requires Mac OS version 10.{0} or above.".format(min_ver),
isError=True)


class Formatter(object):
"""
Expand Down
Loading

0 comments on commit 8b540a5

Please sign in to comment.