Writing You Own Extensions to SmartTerminal

From OpenCircuits
Jump to: navigation, search

Contents

Introduction

This page just started, come back later for something that makes more sense.

This is part of the documentation of the Python Smart Terminal, the starting page is: Python Smart Terminal. While you can, of course modify any of the code for the Smart Terminal the expected way to do it is either through parameters ( see ) or through code. Taking the code approach the plan is that you created a class like the other ext_process_xxxxxx.py components that are in the main code repository ( [Code at GitHub] ).

If you are planning to write an extension make sure you understand the general design of the Smart Terminal Python Smart Terminal Technical and Python Smart Terminal Technical Details Extensions are coded as classes, each extension ( typically ) in its own module.

Examples

All the extensions are included in my github repository, you can study that code. The extensions have names module like: ext_process_xxxxxx.py They include:

  • ext_process_co.py
  • ext_process_ddc.py runs with an arduino program to control a stepper motor clock
  • ext_process_env_monitor.py runs with an arduino program to monitor a greenhouse, or a root cellar, or a well.
  • ext_process_example.py just an example
  • ext_process_gh.py runs with an arduino program to monitor a greenhouse; obsolete, now absorbed into ext_process_env_monitor.py
  • ext_process_ir.py runs with an arduino program to get precise timings from infrared controls, analyze them and send ir pulses, not maintained in a long time might not run.
  • ext_process_motor.py runs with an arduino program to experiment with multiphase motors.
  • ext_process_rc.py runs with an arduino program to monitor a root cellar; obsolete, now absorbed into ext_process_env_monitor.py

I have omitted some modules that are badly incomplete or otherwise broken.


I have additional external documentation for:

Parameters

To make your extension load you need 2 settings in the Parameter file ( parameters.py )

        # add the clock processing extension
        self.ext_processing_module      = "ext_process_ddc"
        self.ext_processing_class       = "DDCProcessing"

This will cause the module to be loaded and the class created. The class holds the code of you extension.

Alter the GUI

Each extension class should have method add_gui( self, parent, ) The argument parent is a parent widget, you should make your own widget, a frame with this parent. Populate the frame with what you want and then return it. If you do not want to make any additions, return None.


Add Processing in the Helper Thread

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox