示例#1
0
 def createLogDisplay(self):
     logTextDisplay = QTextEdit()
     logTextDisplay.setFont(GETFONT('Fixed', 8))
     w, h = relaxedSizeNChar(logTextDisplay, 68)[0], int(12 * 8.2)
     logTextDisplay.setMinimumWidth(w)
     logTextDisplay.setMinimumHeight(h)
     logTextDisplay.setReadOnly(True)
     return logTextDisplay
 def createLogDisplay(self):
    logTextDisplay = QTextEdit()
    logTextDisplay.setFont(GETFONT('Fixed', 8))
    w,h = relaxedSizeNChar(logTextDisplay, 68)[0], int(12 * 8.2)
    logTextDisplay.setMinimumWidth(w)
    logTextDisplay.setMinimumHeight(h)
    logTextDisplay.setReadOnly(True)
    return logTextDisplay
   def __init__(self, parent, main, maxSeg):
      super(DlgSpecifyOrdering, self).__init__(parent, main)
      self.maxSeg = maxSeg
      self.setWindowTitle('Enter Ordering')
      self.setWindowIcon(QIcon(self.main.iconfile))
      buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | \
                                   QDialogButtonBox.Cancel)
      self.connect(buttonbox, SIGNAL('accepted()'), self.accept)
      self.connect(buttonbox, SIGNAL('rejected()'), self.reject)

      layout = QGridLayout()
      lbl =  QLabel('Enter Ordering as a comma separated list of segment indices between 1 and %d:' % maxSeg)
      self.editOrdering = QLineEdit()
      h, w = relaxedSizeNChar(self, 50)
      self.editOrdering.setMinimumSize(h, w)
      self.editOrdering.setMaxLength(MAX_SEGMENTS)
      editSegPanel = makeHorizFrame([self.editOrdering, 'stretch'])
      layout.addWidget(lbl, 0, 0)
      layout.addWidget(editSegPanel, 0, 1)
      layout.addWidget(buttonbox, 1, 0)
      
      self.setLayout(layout)
   def __init__(self, parent, main, isUnknownOrder=False):
      super(DlgEnterSegment, self).__init__(parent, main)
      self.setWindowTitle('Enter Segment')
      self.setWindowIcon(QIcon(self.main.iconfile))
      buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | \
                                   QDialogButtonBox.Cancel)
      self.connect(buttonbox, SIGNAL('accepted()'), self.accept)
      self.connect(buttonbox, SIGNAL('rejected()'), self.reject)

      layout = QGridLayout()
      lbl =  QLabel('Segment Text:')
      self.editSegment = QLineEdit()
      h, w = relaxedSizeNChar(self, 50)
      self.editSegment.setMinimumSize(h, w)
      self.editSegment.setMaxLength(MAX_SEGMENT_LENGTH)
      editSegPanel = makeHorizFrame([self.editSegment, 'stretch'])
      layout.addWidget(lbl, 0, 0)
      layout.addWidget(editSegPanel, 0, 1)
   
      minSelectorLabel = QLabel('Min Length: ')
      maxSelectorLabel = QLabel('Max Length: ')
      self.minSelector = QComboBox()
      self.maxSelector = QComboBox()      
      if isUnknownOrder:
         self.minSelector.setFont(GETFONT('Var', 10, bold=True))
         self.maxSelector.setFont(GETFONT('Var', 10, bold=True))
         for i in range(1,MAX_UNKNOWN_SEGMENT_LENGTH):
            self.minSelector.addItem(str(i))
            self.maxSelector.addItem(str(i))
         # default to 1 to 4
         self.minSelector.setCurrentIndex(0)
         self.maxSelector.setCurrentIndex(0)
         
         # fix the inversion of min and max when user sets min
         def updateMaxSelector():
            minLen = int(str(self.minSelector.currentText()))
            maxLen = int(str(self.maxSelector.currentText()))
            if minLen > maxLen:
               self.maxSelector.setCurrentIndex(minLen - 1)
         
         # fix the inversion of min and max when user sets max
         def updateMinSelector():
            minLen = int(str(self.minSelector.currentText()))
            maxLen = int(str(self.maxSelector.currentText()))
            if minLen > maxLen:
               self.minSelector.setCurrentIndex(maxLen - 1)
               
         main.connect(self.minSelector, SIGNAL('activated(int)'), \
                                             updateMaxSelector)
         main.connect(self.maxSelector, SIGNAL('activated(int)'), \
                                             updateMinSelector)
            
         layout.addWidget(minSelectorLabel, 1, 0)
         minSelectorPanel = makeHorizFrame([self.minSelector,'stretch'])
         layout.addWidget(minSelectorPanel, 1, 1)
         layout.addWidget(maxSelectorLabel, 2, 0)
         maxSelectorPanel = makeHorizFrame([self.maxSelector,'stretch'])
         layout.addWidget(maxSelectorPanel, 2, 1)
         layout.addWidget(buttonbox, 3, 0)
      else:
         layout.addWidget(buttonbox, 1, 0)
      
      self.setLayout(layout)