コード例 #1
0
 def __init__(self):
    wx.Frame.__init__(self, None, -1, 'Quad #1:4')
    bmp14 = AffExpMaps.getbmp14Bitmap()
    self.Image = statbmp.GenStaticBitmap(self, wx.ID_ANY, bmp14)
    self.Image.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
    S = wx.BoxSizer(wx.VERTICAL)
    S.Add(self.Image, 0)
    self.SetSizerAndFit(S)
コード例 #2
0
   def __init__(self):
      wx.Frame.__init__(self,
                          None, -1, 'Affect Expression: Interval Data Entry',
                          size=(1100, 781)
                          )
      global maps, errorReview, coderIDlist, activityList, theclass, nearList,\
               childIDList, affectList, taskList,\
               adultList,affectIntListPos, affectIntListNeg

      errorReview = 0

      panel = wx.Panel(self, -1)

      """ Let's make it look good """
      self.SetBackgroundColour( (217, 241 , 255))

      maps = []

      #get configuration file information
      self.global_paramters = self.GetConfiguration()

      self.panel_length = 60 # should be 30 for interaction/near neighbor
      self.maxcount = 60 # should be 30 for interaction/near neighbor
      if self.global_paramters.has_key('panel_length'):
         self.panel_length = self.global_paramters['panel_length']
      if self.global_paramters.has_key('maxcount'):
         self.maxcount = self.global_paramters['maxcount']

      """ Begin data acquistion section """
      """ Mapping Buttons """
   ## Quad 1
      bmpQ11I = AffExpMaps.getbmpQ11IBitmap()
      bQ11 = buttons.GenBitmapButton(panel, -1, bmpQ11I, (0, 0))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton11, bQ11)

      bmpQ12I = AffExpMaps.getbmpQ12IBitmap()
      bQ12 = buttons.GenBitmapButton(panel, -1, bmpQ12I, (193, 0))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton12, bQ12)

      bmpQ13I = AffExpMaps.getbmpQ13IBitmap()
      bQ13 = buttons.GenBitmapButton(panel, -1, bmpQ13I, (0, 105))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton13, bQ13)

      bmpQ14I = AffExpMaps.getbmpQ14IBitmap()
      bQ14 = buttons.GenBitmapButton(panel, -1, bmpQ14I, (193, 105))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton14, bQ14)

      ## Quad 2
      bmpQ21I = AffExpMaps.getbmpQ21IBitmap()
      bQ21 = buttons.GenBitmapButton(panel, -1, bmpQ21I, (386, 0))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton21, bQ21)

      bmpQ22I = AffExpMaps.getbmpQ22IBitmap()
      bQ22 = buttons.GenBitmapButton(panel, -1, bmpQ22I, (579, 0))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton22, bQ22)

      bmpQ23I = AffExpMaps.getbmpQ23IBitmap()
      bQ23 = buttons.GenBitmapButton(panel, -1, bmpQ23I, (386, 105))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton23, bQ23)

      bmpQ24I = AffExpMaps.getbmpQ24IBitmap()
      bQ24 = buttons.GenBitmapButton(panel, -1, bmpQ24I, (579, 105))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton24, bQ24)

      ## Quad 3
      bmpQ31I = AffExpMaps.getbmpQ31IBitmap()
      bQ31 = buttons.GenBitmapButton(panel, -1, bmpQ31I, (0, 210))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton31, bQ31)

      bmpQ32I = AffExpMaps.getbmpQ32IBitmap()
      bQ32 = buttons.GenBitmapButton(panel, -1, bmpQ32I, (193, 210))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton32, bQ32)

      bmpQ33I = AffExpMaps.getbmpQ33IBitmap()
      bQ33 = buttons.GenBitmapButton(panel, -1, bmpQ33I, (0, 315))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton33, bQ33)

      ## Quad 4
      bmpQ41I = AffExpMaps.getbmpQ41IBitmap()
      bQ41 = buttons.GenBitmapButton(panel, -1, bmpQ41I, (386, 210))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton41, bQ41)

      bmpQ42I = AffExpMaps.getbmpQ42IBitmap()
      bQ42 = buttons.GenBitmapButton(panel, -1, bmpQ42I, (579, 210))
      self.Bind(wx.EVT_BUTTON, self.OnMapButton42, bQ42)

      ##__________________________________________________________

      """ Select Random Child """
      wx.StaticText(panel, -1, "Pick Child Randomly", (30,600))
      ranKid = AffExpMaps.getsmall_red_diceBitmap()
      ranKidGet = buttons.GenBitmapButton(panel, -1, ranKid,\
                                            (40, 615), style = 1)
      self.Bind(wx.EVT_BUTTON, self.OnRanButton, ranKidGet)

      """ Data Selection Section """

      self.playLocation = 101
      notice = wx.StaticText(panel, -1,
                               "Classroom: " + str(self.playLocation),
                               (850, 300)
                               )
      notice.SetFont(wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False))

      """ Interval List  """
      eventList = []
      for x in range(0,61):
         eventList.append(str(x))
      self.labelInterv = wx.StaticText(panel, -1, "  Interval  ", (960, 150))
      self.event = wx.Choice(panel, -1, (965, 165), choices = eventList)
      self.event.SetSelection(1)

      """ Coder List  """
      coderID = []; coderIDlist = []
      coders = csv.reader(open(list_dir + 'coderList.txt'), delimiter=';')
      for each in coders:
         coderID.append(int(each[0]))
         coderIDlist.append(each[1])
      wx.StaticText(panel, -1, "Coder ID List:", (785, 150))
      self.coderID = wx.Choice(panel, -1, (790, 165), choices = coderIDlist)
      self.coderID.SetSelection(0)

      """ Child List; add new names at the end """
      child = []; childIDList = []
      children = csv.reader(open
                              (list_dir + 'room101List.txt'),
                              delimiter = ';'
                              )
      for each in children:
         child.append(int(each[0]))
         childIDList.append(each[1])
      wx.StaticText(panel, -1, "Child List:", (885, 150))
      self.child = wx.Choice(panel, -1, (890, 165), choices = childIDList)
      self.child.SetSelection(0)

      """ Activity List  """
      activityValue = [];  activityList = []
      activity = csv.reader(open
                              (list_dir + 'activityList.txt'),
                              delimiter = ';'
                              )
      for each in activity:
         activityValue.append(int(each[0]))
         activityList.append(each[1])
      wx.StaticText(panel, -1, "Activity", (785, 200))
      self.playActivity = wx.Choice(panel, -1, (790, 215), choices = activityList)
      self.playActivity.SetSelection(0)

      """ AffectIntListPositive  """
      affectIntensityPos = []; affectIntListPos = []
      affectIntPos = csv.reader(open
                                  (list_dir + "affectIntList.txt"),
                                  delimiter = ';'
                                  )
      for each in affectIntPos:
         affectIntensityPos.append(int(each[0]))
         affectIntListPos.append(each[1])
      wx.StaticText(panel, -1, "Child Affect: Positive", (210, 350))
      self.affectIntensityPos = wx.Choice(panel, -1, (225, 365),
                                            choices = affectIntListPos)
      self.affectIntensityPos.SetSelection(0)

      """ AffectIntListNegative  """
      affectIntensityNeg = []; affectIntListNeg = []
      affectIntNeg = csv.reader(open
                                  (list_dir + "affectIntList.txt"),
                                  delimiter = ';'
                                  )
      for each in affectIntNeg:
         affectIntensityNeg.append(int(each[0]))
         affectIntListNeg.append(each[1])
      wx.StaticText(panel, -1, "Child Affect: Negative", (340, 350))
      self.affectIntensityNeg = wx.Choice(panel, -1, (355, 365),
                                            choices = affectIntListNeg)
      self.affectIntensityNeg.SetSelection(0)

      """ Task List  """
      taskValue = []; taskList = []
      task = csv.reader(open
                          (list_dir + "taskList.txt"),
                          delimiter = ';'
                          )
      for each in task:
         taskValue.append(int(each[0]))
         taskList.append(each[1])

      """ Affective Tone List  """
      affectTone = []; affectList = []
      affect = csv.reader(open
                            (list_dir + "affectList.txt"),
                            delimiter = ';'
                            )
      for each in affect:
         affectTone.append(int(each[0]))
         affectList.append(each[1])

      """ Nearby List  """
      nearValue = []; nearList = []
      near = csv.reader(open
                          (list_dir + "room101List.txt"),
                          delimiter = ';'
                          )
      for each in near:
         nearValue.append(int(each[0]))
         nearList.append(each[1])

      """ Peers """
      """ Initiate 1 """
      wx.StaticText(panel, -1, "Initiate 1", (200, 410))
      self.initiate1 = wx.Choice(panel, -1, (200, 425), choices = childIDList)
      self.initiate1.SetSelection(0)
      """ Initiate 2 """
      wx.StaticText(panel, -1, "Initiate 2", (350, 410))
      self.initiate2 = wx.Choice(panel, -1, (350, 425), choices = childIDList)
      self.initiate2.SetSelection(0)
      """ Receive 1 """
      wx.StaticText(panel, -1, "Receive 1", (500, 410))
      self.receive1 = wx.Choice(panel, -1, (500, 425), choices = childIDList)
      self.receive1.SetSelection(0)
      """ Receive 2 """
      wx.StaticText(panel, -1, "Receive 2", (650, 410))
      self.receive2 = wx.Choice(panel, -1, (650, 425), choices = childIDList)
      self.receive2.SetSelection(0)
      """ Receive 3 """
      wx.StaticText(panel, -1, "Receive 3", (805, 410))
      self.receive3 = wx.Choice(panel, -1, (805, 425), choices = childIDList)
      self.receive3.SetSelection(0)

      """ Initiate Tone """
      """ Initiate 1 """
      wx.StaticText(panel, -1, "Tone", (225, 460))
      self.toneinitiate1 = wx.Choice(panel, -1, (200, 475), choices = affectList)
      self.toneinitiate1.SetSelection(0)
      """ Initiate 2 """
      wx.StaticText(panel, -1, "Tone", (375, 460))
      self.toneinitiate2 = wx.Choice(panel, -1, (350, 475), choices = affectList)
      self.toneinitiate2.SetSelection(0)
      """ Receive 1 """
      wx.StaticText(panel, -1, "Tone", (525, 460))
      self.tonereceive1 = wx.Choice(panel, -1, (500, 475), choices = affectList)
      self.tonereceive1.SetSelection(0)
      """ Receive 2 """
      wx.StaticText(panel, -1, "Tone", (675, 460))
      self.tonereceive2 = wx.Choice(panel, -1, (650, 475), choices = affectList)
      self.tonereceive2.SetSelection(0)
      """ Receive 3 """
      wx.StaticText(panel, -1, "Tone", (830, 460))
      self.tonereceive3 = wx.Choice(panel, -1, (805, 475), choices = affectList)
      self.tonereceive3.SetSelection(0)

      """ Category  """
      """ Category Initiate 1 """
      wx.StaticText(panel, -1, "Category", (200, 510))
      self.categoryinitiate1 = wx.Choice(panel, -1, (188, 525), choices = taskList)
      self.categoryinitiate1.SetSelection(0)
      """ Category Initiate 2 """
      wx.StaticText(panel, -1, "Category", (352, 510))
      self.categoryinitiate2 = wx.Choice(panel, -1, (340, 525), choices = taskList)
      self.categoryinitiate2.SetSelection(0)
      """ Category Receive 1 """
      wx.StaticText(panel, -1, "Category", (504, 510))
      self.categoryreceive1 = wx.Choice(panel, -1, (492, 525), choices = taskList)
      self.categoryreceive1.SetSelection(0)
      """ Category Receive 2 """
      wx.StaticText(panel, -1, "Category", (656, 510))
      self.categoryreceive2 = wx.Choice(panel, -1, (644, 525), choices = taskList)
      self.categoryreceive2.SetSelection(0)
      """ Category Receive 3 """
      wx.StaticText(panel, -1, "Category", (808, 510))
      self.categoryreceive3 = wx.Choice(panel, -1, (796, 525), choices = taskList)
      self.categoryreceive3.SetSelection(0)

      """ Near Persons  """
      """ Near Persons 1 """
      wx.StaticText(panel, -1, "Nearby", (200, 560))
      self.Nearbyinitiate1 = wx.Choice(panel, -1, (188, 575), choices = nearList)
      self.Nearbyinitiate1.SetSelection(0)
      """ Near Persons 2 """
      wx.StaticText(panel, -1, "Nearby", (352, 560))
      self.Nearbyinitiate2 = wx.Choice(panel, -1, (340, 575), choices = nearList)
      self.Nearbyinitiate2.SetSelection(0)
      """ Near Persons 3 """
      wx.StaticText(panel, -1, "Nearby", (504, 560))
      self.Nearbyreceive1 = wx.Choice(panel, -1, (492, 575), choices = nearList)
      self.Nearbyreceive1.SetSelection(0)
      """ Near Persons 4 """
      wx.StaticText(panel, -1, "Nearby", (656, 560))
      self.Nearbyreceive2 = wx.Choice(panel, -1, (644, 575), choices = nearList)
      self.Nearbyreceive2.SetSelection(0)
      """ Near Persons 5 """
      wx.StaticText(panel, -1, "Nearby", (808, 560))
      self.Nearbyreceive3 = wx.Choice(panel, -1, (796, 575), choices = nearList)
      self.Nearbyreceive3.SetSelection(0)

      """ Manipulate Data and Store: Buttons """

      errCheck = wx.Button(panel, -1, "Error Check", (830, 3))
      errCheck.SetDefault()
      self.Bind(wx.EVT_BUTTON, self.OnErrorCheck, errCheck)     # Uses OnErrorCheck
      errCheck.SetFont(wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False))
      errCheck.SetToolTipString("Error Check")
      errCheck.SetSize(errCheck.GetBestSize())

      done = wx.Button(panel, -1, "Submit Data", (830, 53))
      self.Bind(wx.EVT_BUTTON, self.OnComplete, done)     # Uses OnComplete
      done.SetFont(wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False))
      done.SetToolTipString("Compile event data")
      done.SetSize(done.GetBestSize())

      ano = wx.Button(panel, -1, "Another Interval", (810, 106))
      self.Bind(wx.EVT_BUTTON, self.OnAnother, ano)       #Uses OnAnother
      ano.SetFont(wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False))
      ano.SetToolTipString("Refresh entry values")
      ano.SetSize(ano.GetBestSize())

      q = wx.Button(panel, -1, "Quit", (975, 650))
      self.Bind(wx.EVT_BUTTON, self.OnClose, q)           #Uses OnClose
      q.SetFont(wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False))
      q.SetToolTipString("This exits the program...")
      q.SetSize(q.GetBestSize())

   ############ gauge #######################
      self.count = 0
      wx.StaticText(panel, -1, "Seconds", (5, 535))
      self.buttonG = wx.Button(panel, -1, "Press to start timer", (25, 550))
      self.buttonG.Bind(wx.EVT_BUTTON, self.buttonGClick)
      self.gauge1 = wx.Gauge(panel, -1, self.panel_length, (5, 500), (165, 35))
      self.gauge1.SetValue(0)
      self.gauge1.SetBezelFace(3)
      self.gauge1.SetShadowWidth(3)
      self.Bind(wx.EVT_TIMER, self.OnTimer)
      self.timerG = wx.Timer(self, -1)
      self.timerG.Start(1000)

   ############### clock ######################

      self.led = gizmos.LEDNumberCtrl(panel, -1, (5,460), (165, 35),
                                        gizmos.LED_ALIGN_CENTER)
      self.led.SetBackgroundColour("red")
      self.red_flag = True
      self.led.SetForegroundColour("black")
      self.OnTimer(None)
      self.timer = wx.Timer(self, -1)
      # update clock digits every second (1000ms)
      self.timer.Start(1000)
      self.Bind(wx.EVT_TIMER, self.OnTimer)