Utility Functions#

Support for GemViz.

getUiFileName(py_file_name)

UI file name matches the Python file, different extension.

iso2dt(iso_date_time)

Convert ISO8601 time string to datetime object.

iso2ts(iso_date_time)

Convert ISO8601 time string to timestamp.

myLoadUi(ui_file[, baseinstance])

Load a .ui file for use in building a GUI.

removeAllLayoutWidgets(layout)

Remove all existing widgets from QLayout.

run_in_thread(func)

(decorator) run func in thread

ts2dt(timestamp)

Convert timestamp to datetime object.

ts2iso(timestamp)

Convert timestamp to ISO8601 time string.

gemviz.utils.getUiFileName(py_file_name)[source]#

UI file name matches the Python file, different extension.

gemviz.utils.iso2dt(iso_date_time)[source]#

Convert ISO8601 time string to datetime object.

gemviz.utils.iso2ts(iso_date_time)[source]#

Convert ISO8601 time string to timestamp.

gemviz.utils.myLoadUi(ui_file, baseinstance=None, **kw)[source]#

Load a .ui file for use in building a GUI.

Wraps uic.loadUi() with code that finds our program’s resources directory.

See:

http://nullege.com/codes/search/PyQt4.uic.loadUi

See:

http://bitesofcode.blogspot.ca/2011/10/comparison-of-loading-techniques.html

inspired by: http://stackoverflow.com/questions/14892713/how-do-you-load-ui-files-onto-python-classes-with-pyside?lq=1

gemviz.utils.removeAllLayoutWidgets(layout)[source]#

Remove all existing widgets from QLayout.

gemviz.utils.run_in_thread(func)[source]#

(decorator) run func in thread

USAGE:

@run_in_thread
def progress_reporting():
    logger.debug("progress_reporting is starting")
    # ...

#...
progress_reporting()   # runs in separate thread
#...
gemviz.utils.ts2dt(timestamp)[source]#

Convert timestamp to datetime object.

gemviz.utils.ts2iso(timestamp)[source]#

Convert timestamp to ISO8601 time string.