nexuslims_logger namespace
Submodules
nexuslims_logger.filewatcher module
FileWatcher will watch a directory,and sync with Cloud periodically.
It will upload any files (require file types match if specified) (modified after certain time if specified) that checksum changed wrt. cache (if any) to a GCP cloud bucket in a specified interval.
- class nexuslims_logger.filewatcher.FileWatcher(watch_dir, bucket_name, bucket_dir, credential_fn, cache_fn, interval=600, file_types=None, mtime_since=None, instr_info=None, logger=None)[source]
Bases:
object- property bucket_dir
- get_files_to_upload()[source]
find files to upload recursively and return list of abs file names and content checksum.
file satisfying the following condition will be considered for uploading: - file type is allowed (set in app config) - file modification timestamp is after the set threshold (session start time) - file content checksum does not exist in cache or updated.
- property instr_info
- property interval
- property mtime_since
nexuslims_logger.instrument module
- class nexuslims_logger.instrument.GCPInstrument(output_dir, bucket_name, bucket_dir, credential_fn, logger=None)[source]
Bases:
nexuslims_logger.instrument.InstrumentMock an instrument with data stored in GCP.
nexuslims_logger.loggerhub module
LoggerHub
- class nexuslims_logger.loggerhub.App(config, cred_json, cache_json, verbose=20)[source]
Bases:
tkinter.Tk
- class nexuslims_logger.loggerhub.ConsoleUi(frame, logger)[source]
Bases:
objectPoll messages from a logging queue and display them in a scrolled text widget
- class nexuslims_logger.loggerhub.DBSessionLogger(cpu_name, dbapi_url, dbapi_username=None, dbapi_password=None, user=None, logger=None)[source]
Bases:
objectcommunicate with database.
- last_session_ended()[source]
Check the database for this instrument to make sure that the last entry in the db was an “END” (properly ended). If it’s not, return False so the GUI can query the user for additional input on how to proceed.
- Returns
is_success (bool) – If the database is consistent (i.e. the last log for this instrument is an “END” log), return True. If not (it’s a “START” log), return False
msg (str)
- process_end()[source]
Insert a session ‘END’ log for this computer’s instrument, and change the status of the corresponding ‘START’ entry from ‘WAITING_FOR_END’ to ‘TO_BE_BUILT’
- class nexuslims_logger.loggerhub.QueueHandler(log_queue)[source]
Bases:
logging.HandlerClass to send logging records to a queue It can be used from different threads The ConsoleUi class polls this queue to display records in a ScrolledText widget
nexuslims_logger.loggertem module
LoggerTEM GUI
- class nexuslims_logger.loggertem.App(hubaddr, watchdir, user=None, screen_res=None, logger=None, log_text=None)[source]
Bases:
tkinter.Tk- destroy()[source]
Destroy this and all descendants widgets. This will end the application of this Tcl interpreter.
- done_loading()[source]
actions by the end of loading.
put off
setup_frame, put uprunning_frameand labels, enable buttons.
- draw_info()[source]
information section
incl. loading text, progress bar, instrument label, datetime
- session_end()[source]
routines for session ending.
change the frame, update loading text and progress bar.
- switch_gui_to_end()[source]
actions by the start of ending.
put off
running_frame; putupsetup_frame, diable buttons
- class nexuslims_logger.loggertem.ConfirmUi(parent, query)[source]
Bases:
tkinter.ToplevelPopup window ask user for confirmation It has three buttons: yes, no, cancel
- class nexuslims_logger.loggertem.HangingSessionDialog(parent)[source]
Bases:
tkinter.ToplevelDialogue window prompt user for actions when previous session is detected not ended properly.
- class nexuslims_logger.loggertem.PauseOrEndDialogue(parent)[source]
Bases:
tkinter.ToplevelDialogue window prompts user for actions when the user is closing the main window
- class nexuslims_logger.loggertem.ToolTip(wdgt, tooltip_font='TkDefaultFont', msg=None, msgFunc=None, header_msg=None, delay=1, follow=True)[source]
Bases:
tkinter.ToplevelProvides a ToolTip widget for Tkinter. To apply a ToolTip to any Tkinter widget, simply pass the widget to the ToolTip constructor
- hide(event=None)[source]
Hides the ToolTip. Usually this is caused by leaving the widget :param event: The event that called this function
nexuslims_logger.utils module
utility functions
- class nexuslims_logger.utils.Config(dict=None, /, **kwargs)[source]
Bases:
collections.UserDictsubclass dict, get keys from environment first.
- class nexuslims_logger.utils.ScreenRes(logger=None)[source]
Bases:
object- get_center_geometry_string(width, height)[source]
This method will return a Tkinter geometry string that will place a Toplevel window into the middle of the screen given the widget’s width and height (using a Windows command or xrandr as needed). If it fails for some reason, a basic resolution of 800x600 is assumed.
- Parameters
- Returns
geometry_string – The Tkinter geometry string that will put a window of width and height at the center of the screen given the current resolution (of the format “WIDTHxHEIGHT+XPOSITION+YPOSITION”)
- Return type
- nexuslims_logger.utils.check_singleton()[source]
make sure only ONE instance of the program running.