コード例 #1
0
def evt_display_file_info(parent, event):
    try:
        g = parent.panelDM.fid2
    except:
        gui_message.error(
            "Must enter file or variable name in the 'File' or 'Variable' entry window."
        )
        return
    try:
        v = parent.panelDM.var3
    except:
        v = parent.panelDM.var3 = None

    if (v is not None) or (g is not None):
        if v is not None:
            info_text = gui_functions._scn_a_var(parent, v)
        else:
            info_text = gui_functions._scn_a_file(parent, v, g)

        dialog = Pmw.Dialog(
            parent,
            buttons=('Dismiss', ),
            defaultbutton='OK',
            title='%s  -  File Variable Information' % v,
            #command = gui_control.Command(evt_dispose_execute, parent)
        )
        dialog.transient(parent)  # draw widget on top of its parent

        # Create the ScrolledText.
        sclt = Pmw.ScrolledText(dialog.interior(),
                                borderframe=1,
                                labelpos='n',
                                usehullsize=1,
                                hull_width=400,
                                hull_height=300,
                                text_background='white',
                                text_foreground='black',
                                text_padx=10,
                                text_pady=10,
                                text_wrap='none')
        sclt.pack(padx=5, pady=5, fill='both', expand=1)
        sclt.settext(info_text)
        sclt.configure(text_state='disabled')

        # Position dialog popup
        parent_geom = parent.geometry()
        geom = string.split(parent_geom, '+')
        geom2 = string.split(geom[0], 'x')
        d1 = string.atoi(geom[1])
        d2 = string.atoi(geom[2])
        d3 = string.atoi(geom2[0])
        d4 = string.atoi(geom2[1]) * 0.88
        dialog.activate(geometry="%dx%d+%d+%d" % (d3, d4, d1, d2))
    else:
        gui_message.error(
            "Must enter file or variable name in the 'File' or 'Variable' entry window."
        )
コード例 #2
0
ファイル: gui_select_variable.py プロジェクト: AZed/uvcdat
def evt_display_file_info( parent, event ):
   try: g = parent.panelDM.fid2
   except: 
        gui_message.error("Must enter file or variable name in the 'File' or 'Variable' entry window.")
        return
   try:
      v =parent.panelDM.var3
   except:
      v = parent.panelDM.var3 = None

   if (v is not None) or (g is not None):
      if v is not None:
         info_text = gui_functions._scn_a_var( parent, v )
      else:
         info_text = gui_functions._scn_a_file( parent, v, g )

      dialog = Pmw.Dialog(parent,
                buttons = ('Dismiss',),
                defaultbutton = 'OK',
                title = '%s  -  File Variable Information' % v,
                #command = gui_control.Command(evt_dispose_execute, parent)
        )
      dialog.transient( parent ) # draw widget on top of its parent

      # Create the ScrolledText.
      sclt = Pmw.ScrolledText(dialog.interior(),
                borderframe = 1,
                labelpos = 'n',
                usehullsize = 1,
                hull_width = 400,
                hull_height = 300,
                text_background = 'white',
                text_foreground = 'black',
                text_padx = 10,
                text_pady = 10,
                text_wrap='none'
      )
      sclt.pack(padx = 5, pady = 5, fill = 'both', expand = 1)
      sclt.settext( info_text )
      sclt.configure( text_state = 'disabled' )

      # Position dialog popup
      parent_geom = parent.geometry()
      geom = string.split(parent_geom, '+')
      geom2 = string.split(geom[0], 'x')
      d1 = string.atoi( geom[1] )
      d2 = string.atoi( geom[2] )
      d3 = string.atoi( geom2[0] )
      d4 = string.atoi( geom2[1] ) * 0.88
      dialog.activate( geometry="%dx%d+%d+%d" % (d3, d4, d1, d2) )
   else:
      gui_message.error("Must enter file or variable name in the 'File' or 'Variable' entry window.")
コード例 #3
0
ファイル: gui_select_variable.py プロジェクト: AZed/uvcdat
def evt_enter_variable( parent, event ):
   a = b = parent.panelSV.tin4.get()
   parent.panelSV.lab1.configure(text = "Select Variable")
   if a.find('- [') != -1:
      a=a[:a.find('- [')]
   if a.find('(') !=-1:
      a = a[:a.rfind('(')-1]
   parent.panelSV.tin4.setentry( a )
   if parent.startusertask == 1: gui_control.track_user( parent, "Variable: %s" % a)
   #
   if ( (a[17:] in ['Variable List *************']) or (a in ['******** Bounds and Weights List ******', '*************** Axes List **************']) ):
     parent.panelSV.tin4.setentry( '' )
     gui_functions._blank_dim1_to_ndim( parent )
     parent.panelDM.var3 = parent.panelDM.remember_var3 = None
     return
   parent.panelDM.var3 = parent.panelDM.remember_var3 = a
   #
   parent.panelSV.tin4.first_time = 0
   #
   var_list = parent.panelSV.tin4._list.get(None)
   found = 0
   for j in range(len(var_list)):
      n = len(a)
      if a+' '==var_list[j][:n+1]:
         found = 1
         break
##          if var_list[j].find('(') == -1:
##             if a == var_list[j]: 
##                found = 1
##                break
##          else:
##             if a == var_list[j][:var_list[j].find('(')-1]: 
##                found = 1
##                break
##          j = j + 1
   if found == 0:
      gui_message.error('Variable [ ++%s++ ] cannot be found in the file.' % a)
      parent.panelSV.tin4.setentry( '' )
      gui_functions._blank_dim1_to_ndim( parent )
      parent.panelDM.var3 = parent.panelDM.remember_var3 = None
      return
   #
   parent.panelVI.lst1 = gui_functions._scn_a_var( parent, a )
   parent.panelVI.scl1.settext( parent.panelVI.lst1 )

   # Blank the dimension's window
   gui_functions._blank_dim1_to_ndim( parent )

   # Reset selection counters back to initial state, (e.g., '00 ')
   if parent.panelDV.lst1 != {}:
      for x in parent.panelDV.lst1.keys():
          parent.panelDV.number_lst1[ x ] = gui_control.dvholder + x
      gui_defined_variables.update_defined_variable_list( parent )

   gui_functions._srl_var_dim1_to_ndim( parent )
   for k in range(parent.panelDM.ndim):
      parent.panelDM.dim[k].comb.component('entry').configure(background = gui_color.dim )
      parent.panelDM.dim[k].first_scl.configure( troughcolor=gui_color.dim )
      parent.panelDM.dim[k].last_scl.configure( troughcolor=gui_color.dim )
   #
   parent.panelDV.scl1.select_clear( 0, 'end' )
   parent.panelDV.selected_list = {}
   #
   parent.panelSV.lab1.configure(text = "Selected Variable -- %s" % b)
コード例 #4
0
def evt_enter_variable(parent, event):
    a = b = parent.panelSV.tin4.get()
    parent.panelSV.lab1.configure(text="Select Variable")
    if a.find('- [') != -1:
        a = a[:a.find('- [')]
    if a.find('(') != -1:
        a = a[:a.rfind('(') - 1]
    parent.panelSV.tin4.setentry(a)
    if parent.startusertask == 1:
        gui_control.track_user(parent, "Variable: %s" % a)
    #
    if ((a[17:] in ['Variable List *************']) or (a in [
            '******** Bounds and Weights List ******',
            '*************** Axes List **************'
    ])):
        parent.panelSV.tin4.setentry('')
        gui_functions._blank_dim1_to_ndim(parent)
        parent.panelDM.var3 = parent.panelDM.remember_var3 = None
        return
    parent.panelDM.var3 = parent.panelDM.remember_var3 = a
    #
    parent.panelSV.tin4.first_time = 0
    #
    var_list = parent.panelSV.tin4._list.get(None)
    found = 0
    for j in range(len(var_list)):
        n = len(a)
        if a + ' ' == var_list[j][:n + 1]:
            found = 1
            break
##          if var_list[j].find('(') == -1:
##             if a == var_list[j]:
##                found = 1
##                break
##          else:
##             if a == var_list[j][:var_list[j].find('(')-1]:
##                found = 1
##                break
##          j = j + 1
    if found == 0:
        gui_message.error('Variable [ ++%s++ ] cannot be found in the file.' %
                          a)
        parent.panelSV.tin4.setentry('')
        gui_functions._blank_dim1_to_ndim(parent)
        parent.panelDM.var3 = parent.panelDM.remember_var3 = None
        return
    #
    parent.panelVI.lst1 = gui_functions._scn_a_var(parent, a)
    parent.panelVI.scl1.settext(parent.panelVI.lst1)

    # Blank the dimension's window
    gui_functions._blank_dim1_to_ndim(parent)

    # Reset selection counters back to initial state, (e.g., '00 ')
    if parent.panelDV.lst1 != {}:
        for x in parent.panelDV.lst1.keys():
            parent.panelDV.number_lst1[x] = gui_control.dvholder + x
        gui_defined_variables.update_defined_variable_list(parent)

    gui_functions._srl_var_dim1_to_ndim(parent)
    for k in range(parent.panelDM.ndim):
        parent.panelDM.dim[k].comb.component('entry').configure(
            background=gui_color.dim)
        parent.panelDM.dim[k].first_scl.configure(troughcolor=gui_color.dim)
        parent.panelDM.dim[k].last_scl.configure(troughcolor=gui_color.dim)
    #
    parent.panelDV.scl1.select_clear(0, 'end')
    parent.panelDV.selected_list = {}
    #
    parent.panelSV.lab1.configure(text="Selected Variable -- %s" % b)