# Path: janus_event_LineEdit.py
# class event_LineEdit( QLineEdit ) :
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE INITIALIZATION FUNCTION.
# 	#-----------------------------------------------------------------------
# 
# 	def __init__( self, owner, fnc ) :
# 
# 
# 		# Inherit all attributes of an instance of "QLineEdit".
# 
# 		super( event_LineEdit, self ).__init__( )
# 
# 
# 		# Store the user-provided instance of the initializing object.
# 
# 		self.owner = owner
# 
# 
# 		# Store the string indicating the function of this text area.
# 
# 		self.fnc = fnc
# 
# 
# 		# Intialize "text_old" with the current text in this text box.
# 
# 		# Note.  This variable is useful for establishing if and how
# 		#        the text was changed.  For example, the
# 		#        "editingFinished()" signal is sent if a user removes
# 		#        focus from this widget even if no actual edits were
# 		#        made.
# 
# 		self.text_old = self.text( )
# 
# 
# 		# If the 'editingFinished()' signal is emitted (i.e., this
# 		# widget looses the "focus"), notify "self.owner".
# 
# 		self.connect( self, SIGNAL('editingFinished()'),
# 		              self.signal_editingFinished        )
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE FUNCTION FOR SETTING THE TEXT AND UPDATING THE OLD TEXT.
# 	#-----------------------------------------------------------------------
# 
# 	def setTextUpdate( self, text ) :
# 
# 
# 		# Set the text of this text box to that requested by the user.
# 
# 		self.setText( text )
# 
# 
# 		# Update the record of the "old text" to the current text.
# 
# 		self.text_old = self.text( )
# 
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE FUNCTION FOR RESPONDING TO THE SIGNAL FOR EDITING FINISHED.
# 	#-----------------------------------------------------------------------
# 
# 	def signal_editingFinished( self ) :
# 
# 
# 		# If an actual change has been made to the text of this text 
# 		# box, notify "self.owner" that this has occured.
# 
# 		if ( self.text( ) != self.text_old ) :
# 
# 			self.text_old = self.text( )
# 
# 			self.owner.user_event( None, self.fnc )
# 
# Path: janus_thread.py
# def n_thread( ) :
# 
# 	n = 0
# 
# 	for thr in ThreadList( ) :
# 		if ( ( thr._Thread__target is thread_load_spec        ) or
# 		     ( thr._Thread__target is thread_anls_mom         ) or
# 		     ( thr._Thread__target is thread_anls_nln         ) or
# 		     ( thr._Thread__target is thread_chng_dsp         ) or
# 		     ( thr._Thread__target is thread_chng_dyn         ) or
# 		     ( thr._Thread__target is thread_chng_opt         ) or
# 		     ( thr._Thread__target is thread_rstr_opt         ) or
# 		     ( thr._Thread__target is thread_auto_run         ) or
# 		     ( thr._Thread__target is thread_save_res         ) or
# 		     ( thr._Thread__target is thread_xprt_res         ) or
# 		     ( thr._Thread__target is thread_chng_mom_sel     ) or
#                      ( thr._Thread__target is thread_auto_mom_sel     ) or
# 		     ( thr._Thread__target is thread_chng_nln_spc     ) or
# 		     ( thr._Thread__target is thread_chng_nln_pop     ) or
# 		     ( thr._Thread__target is thread_chng_nln_set     ) or
# 		     ( thr._Thread__target is thread_chng_nln_gss     ) or
# 		     ( thr._Thread__target is thread_chng_nln_sel     ) or
# 		     ( thr._Thread__target is thread_chng_mom_win_dir ) or
# 		     ( thr._Thread__target is thread_chng_mom_win_bin )   ) :
# 			n += 1
# 
# 	return n
# 
# def thread_chng_nln_spc( core, s, param, val ) :
# 
# 	core.emit( SIGNAL('janus_busy_end') )
# 	core.emit( SIGNAL('janus_busy_beg') )
# 
# 	core.chng_nln_spc( s, param, val )
# 
# 	core.emit( SIGNAL('janus_busy_end') )


from PyQt4.QtCore import SIGNAL, Qt
from PyQt4.QtGui import QGridLayout, QLabel, QLineEdit, QWidget
from janus_event_LineEdit import event_LineEdit
from numpy import tile
from threading import Thread
from janus_thread import n_thread, thread_chng_nln_spc
		                                        self.resp_chng_nln_ion )

		# Give this widget a grid layout, "self.grd".

		self.grd = QGridLayout( )

		self.setLayout( self.grd )

		# |   0   |   1   |   2   |   3   |   4   |   5   |
		# +-------+-------+-------+-------+-------+-------+
		# | Name                  |  Sym  | m/m_p | q/q_p |
		# | LineEdit              | LineE | LineE | LineE |

		# Initialize the labels, check boxes, and text areas that 
		# comprise this widget.

		self.hdr_name  = QLabel( 'Species Name' )
		self.hdr_sym   = QLabel( 'Symbol'       )
		self.hdr_m     = QLabel( 'm / m_p'      )
		self.hdr_q     = QLabel( 'q / q_p'      )

		self.arr_name  = tile( None, self.core.nln_n_pop )
		self.arr_sym   = tile( None, self.core.nln_n_pop )
		self.arr_m     = tile( None, self.core.nln_n_pop )
		self.arr_q     = tile( None, self.core.nln_n_pop )

		for i in range( self.core.nln_n_spc ) :

			txt_i = str( i )


# Path: janus_event_LineEdit.py
# class event_LineEdit( QLineEdit ) :
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE INITIALIZATION FUNCTION.
# 	#-----------------------------------------------------------------------
# 
# 	def __init__( self, owner, fnc ) :
# 
# 
# 		# Inherit all attributes of an instance of "QLineEdit".
# 
# 		super( event_LineEdit, self ).__init__( )
# 
# 
# 		# Store the user-provided instance of the initializing object.
# 
# 		self.owner = owner
# 
# 
# 		# Store the string indicating the function of this text area.
# 
# 		self.fnc = fnc
# 
# 
# 		# Intialize "text_old" with the current text in this text box.
# 
# 		# Note.  This variable is useful for establishing if and how
# 		#        the text was changed.  For example, the
# 		#        "editingFinished()" signal is sent if a user removes
# 		#        focus from this widget even if no actual edits were
# 		#        made.
# 
# 		self.text_old = self.text( )
# 
# 
# 		# If the 'editingFinished()' signal is emitted (i.e., this
# 		# widget looses the "focus"), notify "self.owner".
# 
# 		self.connect( self, SIGNAL('editingFinished()'),
# 		              self.signal_editingFinished        )
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE FUNCTION FOR SETTING THE TEXT AND UPDATING THE OLD TEXT.
# 	#-----------------------------------------------------------------------
# 
# 	def setTextUpdate( self, text ) :
# 
# 
# 		# Set the text of this text box to that requested by the user.
# 
# 		self.setText( text )
# 
# 
# 		# Update the record of the "old text" to the current text.
# 
# 		self.text_old = self.text( )
# 
# 
# 
# 	#-----------------------------------------------------------------------
# 	# DEFINE THE FUNCTION FOR RESPONDING TO THE SIGNAL FOR EDITING FINISHED.
# 	#-----------------------------------------------------------------------
# 
# 	def signal_editingFinished( self ) :
# 
# 
# 		# If an actual change has been made to the text of this text 
# 		# box, notify "self.owner" that this has occured.
# 
# 		if ( self.text( ) != self.text_old ) :
# 
# 			self.text_old = self.text( )
# 
# 			self.owner.user_event( None, self.fnc )
# 
# Path: janus_thread.py
# def n_thread( ) :
# 
# 	n = 0
# 
# 	for thr in ThreadList( ) :
# 		if ( ( thr._Thread__target is thread_load_spec        ) or
# 		     ( thr._Thread__target is thread_anls_mom         ) or
# 		     ( thr._Thread__target is thread_anls_nln         ) or
# 		     ( thr._Thread__target is thread_chng_dsp         ) or
# 		     ( thr._Thread__target is thread_chng_dyn         ) or
# 		     ( thr._Thread__target is thread_chng_opt         ) or
# 		     ( thr._Thread__target is thread_rstr_opt         ) or
# 		     ( thr._Thread__target is thread_auto_run         ) or
# 		     ( thr._Thread__target is thread_save_res         ) or
# 		     ( thr._Thread__target is thread_xprt_res         ) or
# 		     ( thr._Thread__target is thread_chng_mom_sel     ) or
#                      ( thr._Thread__target is thread_auto_mom_sel     ) or
# 		     ( thr._Thread__target is thread_chng_nln_spc     ) or
# 		     ( thr._Thread__target is thread_chng_nln_pop     ) or
# 		     ( thr._Thread__target is thread_chng_nln_set     ) or
# 		     ( thr._Thread__target is thread_chng_nln_gss     ) or
# 		     ( thr._Thread__target is thread_chng_nln_sel     ) or
# 		     ( thr._Thread__target is thread_chng_mom_win_dir ) or
# 		     ( thr._Thread__target is thread_chng_mom_win_bin )   ) :
# 			n += 1
# 
# 	return n
# 
# def thread_chng_nln_spc( core, s, param, val ) :
# 
# 	core.emit( SIGNAL('janus_busy_end') )
# 	core.emit( SIGNAL('janus_busy_beg') )
# 
# 	core.chng_nln_spc( s, param, val )
# 
# 	core.emit( SIGNAL('janus_busy_end') )


# Path: janus_widget_nln_spc.py
from PyQt4.QtCore import SIGNAL, Qt
from PyQt4.QtGui import QGridLayout, QLabel, QLineEdit, QWidget
from janus_event_LineEdit import event_LineEdit
from numpy import tile
from threading import Thread
from janus_thread import n_thread, thread_chng_nln_spc

		                                        self.resp_chng_nln_ion )

		# Give this widget a grid layout, "self.grd".

		self.grd = QGridLayout( )

		self.setLayout( self.grd )

		# |   0   |   1   |   2   |   3   |   4   |   5   |
		# +-------+-------+-------+-------+-------+-------+
		# | Name                  |  Sym  | m/m_p | q/q_p |
		# | LineEdit              | LineE | LineE | LineE |

		# Initialize the labels, check boxes, and text areas that 
		# comprise this widget.

		self.hdr_name  = QLabel( 'Species Name' )
		self.hdr_sym   = QLabel( 'Symbol'       )
		self.hdr_m     = QLabel( 'm / m_p'      )
		self.hdr_q     = QLabel( 'q / q_p'      )

		self.arr_name  = tile( None, self.core.nln_n_pop )
		self.arr_sym   = tile( None, self.core.nln_n_pop )
		self.arr_m     = tile( None, self.core.nln_n_pop )
		self.arr_q     = tile( None, self.core.nln_n_pop )

		for i in range( self.core.nln_n_spc ) :

			txt_i = str( i )


			self.arr_name[i] = event_LineEdit( self, 'n'+txt_i )