Changes

Jump to navigation Jump to search
Line 81: Line 81:  
  zyngui.run_start_thread()
 
  zyngui.run_start_thread()
   −
=== xynthian/zynthian_gui.py ===
+
The zynthian configuration data is imported as zyngui, zynthian_gui and zynthian_gui_config.zyngui. They are all the same global python object. You keep the number of globals down to an absolute minimum and restrict yourself to objects. zyngui as it will hence forth be known is the Global Python object that the Zynthians GUI hangs off.  
   −
/zynthian/zynthian-ui/zynthian_gui.py
+
== Zynthian Objects ==
   −
This module primarily defines the zynthian_gui class object with a few tkinter helper functions
+
{| class="wikitable"
and this is what actually handles all the GUI interaction and functionality.
+
|+ Caption text
 +
|-
 +
! Zynthian Object !! Object Definition File !! Object Name
 +
|-
 +
| zyngui || zyngui.zynthian_gui || zynthian_gui
 +
|-
 +
| Example || Example || Example
 +
|-
 +
| Example || Example || Example
 +
|}
   −
It's about 2000 lines of code and after all this definition
+
=== zyngui ===
   −
At line 1775 or there abouts we get
+
Defined in the module zyngui/zynthian_gui.py as zynthian_gui but used as the global variable zyngui.
 
  −
* logging.info("STARTING ZYNTHIAN-UI ...")
  −
Always good to log and use the python logging infrastructure.
  −
* zynthian_gui_config.zyngui=zyngui=zynthian_gui()
     −
Some name binding for maintaining different names spaces or some possibly more nefereous purpose, before running
+
Firstly, virtually the entire zynthian universe is imported in about the first one hundred lines defining 80 or so base python namespaces.
* zyngui.start()
     −
This method of the zynthian_gui class configures the GUI environment ready to start.
+
Everything from the zynseq to brightness_config including the links to the C libraries that actually do the work as lib_zyncore, the zynengine objects that wrap the audio and MIDI devices and the many components used by the GUI screen.
 +
 
 +
It also defines the threads that respond to the various events that occur within  the GUI environment and the various devices connected to the zynthian like Keyboards both musical and QWERTY, mice and all manner of MIDI paraphernalia.
 +
 
 +
Then the zynthian_gui Object is defined.
 +
==== Functions ====
 +
===== create_screens =====
 +
The zynautoconnector is started which establishes the jack client connection to the Jack Server that does all the actual audio and midi processing, and runs this in it's own thread and handles the locking to ensure components play nice.
 +
 
 +
The global references for the audio recorder, the mixer and the sequencer are instantiated from there modules
 +
{| class="wikitable"
 +
|+ Caption text
 +
|-
 +
! object !! module !! function
 +
|-
 +
| self.audio_recorder || zyngui/zynthian_audio_recorder || Audio Recorder
 +
|-
 +
| self.zynmixer || zynthian_engine_audio_mixer || Mixer
 +
|-
 +
| self.zynseq || zynlibs/zynseq || Sequencer
 +
|}
 +
 
 +
A dictionary called screens is defined and this has string keys that points to the individually defined screen objects that display the appropriate screens is defined and the value of the dictionary si set to the instantiated object from the .zyngui modules.
 +
 
 +
# Create Core UI Screens
 +
self.screens['info'] = zynthian_gui_info()
 +
self.screens['splash'] = zynthian_gui_splash()
 +
self.screens['loading'] = zynthian_gui_loading()
 +
self.screens['confirm'] = zynthian_gui_confirm()
 +
....
 +
 
 +
The main menu is set depending on the zynthian kit...
 +
 
 +
and the zynthian device manager is instantiated.
 +
 
 +
Then the threads and polling mechanisms are started .
584

edits

Navigation menu