Example #1
0
  def __init__(self, parent, orient = Tkinter.HORIZONTAL, relief='solid', color='black',
               bgColor = 'grey', *args, **kw):

    if (orient == Tkinter.HORIZONTAL):
      size = kw.get('height', 1)
    else:
      size = kw.get('width', 1)
      
    if relief =='solid':
      kw['relief'] = 'flat'
    else:
      kw['relief'] = relief
    
    
    kw['borderwidth'] = (size-1)/2
    
    apply(Frame.__init__, (self, parent) + args, kw)

    self.config(bg=color)
    self.relief = relief

    if self.relief in ('solid','flat'):
      color2 = bgColor
    else:
      color2 = color
 
    self.grid_columnconfigure(0, weight=1)
    self.grid_rowconfigure(0, weight=1)
    self.innerFrame = Frame(self, borderwidth=0, bg=color2)
    self.innerFrame.grid(sticky = Tkinter.NSEW)     
    self.innerFrame.grid_columnconfigure(0, weight=1)
    self.innerFrame.grid_rowconfigure(0, weight=1)
Example #2
0
    def body(self, guiParent):

        # Ensure that the first row and column in popup expand
        guiParent.grid_rowconfigure(0, weight=1)
        guiParent.grid_columnconfigure(0, weight=1, minsize=200)
        frame = Frame(guiParent)  # Body widgets can be put in this frame
        frame.grid()

        buttons = createDismissHelpButtonList(frame,
                                              dismiss_text='Quit',
                                              dismiss_cmd=self.quit,
                                              help_url=self.help_url,
                                              expands=1)
        buttons.grid(row=0, column=0, sticky=Tkinter.NSEW)

        self.helpButton = buttons.buttons[-1]
        self.helpButtonCommand = self.helpButton.buttonCommand  # the command with no project

        # Dictionary to store popups opened by this application - e.g. need to close upon quit
        self.popups = {}

        # Default font
        self.font = 'Helvetica 10'

        # Closing the window from the desktop environment calls the proper quit
        self.protocol('WM_DELETE_WINDOW', self.quit)

        self.mainMenu = Menu(self)
        self.projectMenu = self.makeProjectMenu()
        self.otherMenu = self.makeOtherMenu()

        # Put the main menu
        self.config(menu=self.mainMenu)

        self.initProject()
Example #3
0
    def __init__(self, guiParent, basePopup):
        # Base popup required to handle notification of data model changes
        # e.g. new peak lists, so that the GUI can update to the latest
        # state

        print 'setting up userFrame'

        self.basePopup = basePopup
        self.guiParent = guiParent

        self.registerNotify = basePopup.registerNotify
        self.unregisterNotify = basePopup.unregisterNotify

        Frame.__init__(self, guiParent)

        self.grid_columnconfigure(0, weight=0, minsize=10)
        self.grid_columnconfigure(1, weight=1)
        self.grid_columnconfigure(2, weight=1)
        self.grid_columnconfigure(3, weight=1)
        self.grid_columnconfigure(4, weight=1)

        self.grid_rowconfigure(0, weight=0, minsize=10)
        self.grid_rowconfigure(1, weight=0, minsize=10)
        self.grid_rowconfigure(2, weight=0, minsize=10)

        self.draw()
Example #4
0
    def __init__(self, parent, guiParent, *args, **kw):

        Frame.__init__(self, parent, *args, **kw)

        self.guiParent = guiParent
        self.aliasing = 0
        self.peakDim = None
        self.contrib = None
        self.component = None
        self.structure = None
        self.resonances = []
        self.jCouplings = []

        headingList = ['#', 'Name', 'Delta', 'Shift', 'SD', 'Dist']
        self.scrolledMatrix = ScrolledMatrix(self,
                                             initialRows=5,
                                             headingList=headingList,
                                             tipTexts=TIP_TEXTS,
                                             callback=self.setCurrentResonance,
                                             highlightType=None)

        row = 0
        self.scrolledMatrix.grid(row=row,
                                 column=0,
                                 columnspan=2,
                                 sticky='nsew',
                                 padx=1)
        self.grid_rowconfigure(row, weight=1)

        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)

        self.update(None, None)
Example #5
0
  def __init__(self, guiParent, basePopup, rep1=None, rep2=None):
    
    self.basePopup = basePopup
    self.guiParent = guiParent

    # add this to shortcuts to ease navigation    
    self.basePopup.frameShortcuts['DataExch'] = self

    # FIXME

    # This is a hack just so that we can see what it would be like
    # need to set these in a different way!!

    self.repository1 = self.basePopup.repList.currentRepository
    self.repository2 = self.basePopup.repList.currentRepository

    Frame.__init__(self, guiParent)
  
    self.grid_columnconfigure(0, weight=0, minsize=10)
    self.grid_columnconfigure(1, weight=1, minsize=20)
    self.grid_columnconfigure(2, weight=0, minsize=40)
    self.grid_columnconfigure(3, weight=1, minsize=20)
    self.grid_columnconfigure(4, weight=0, minsize=10)

    self.grid_rowconfigure(0, weight=0, minsize=10)
    self.grid_rowconfigure(1, weight=0, minsize=10)
    self.grid_rowconfigure(2, weight=0, minsize=10)
    self.grid_rowconfigure(3, weight=1, minsize=10)
    self.grid_rowconfigure(4, weight=0, minsize=10)

    # build up the body. start really simple

    self.repLabel1 = Label(self, text='Repository 1')
    self.repLabel2 = Label(self, text='Repository 2')

    self.noDataWidgets = []

    self.noRep1Label = Label(self,text='No repository currently selected.')
    self.noDataWidgets.append(self.noRep1Label)
    self.noRep2Label = Label(self,text='No repository currently selected.')
    self.noDataWidgets.append(self.noRep2Label)

    # widgets for view when current repository set

    self.dataWidgets1 = []

    self.label1 = Label(self)
    self.dataWidgets1.append(self.label1)
    self.frame1 = Tree(self)
    self.dataWidgets1.append(self.frame1)
    
    self.dataWidgets2 = []

    self.label2 = Label(self)
    self.dataWidgets2.append(self.label2)
    self.frame2 = Tree(self)
    self.dataWidgets2.append(self.frame2)

    self.drawFrame()
Example #6
0
    def destroy(self):

        self.setOptionValues()

        if self.file_select_popup:
            self.file_select_popup.destroy()

        Frame.destroy(self)
Example #7
0
  def __init__(self, guiParent, basePopup):

    # Base popup required to handle notification of data model changes
    # e.g. new peak lists, so that the GUI can update to the latest
    # state
    self.basePopup = basePopup
    self.guiParent = guiParent

    self.registerNotify=basePopup.registerNotify
    self.unregisterNotify=basePopup.unregisterNotify


    Frame.__init__(self, guiParent)
  
    # set up the grid

    self.grid_columnconfigure(0, weight=1, minsize=10)
    self.grid_columnconfigure(1, weight=0, minsize=10)
    self.grid_columnconfigure(2, weight=0, minsize=20)
    self.grid_columnconfigure(3, weight=1, minsize=10)

    self.grid_rowconfigure(0, weight=1, minsize=5)
    self.grid_rowconfigure(1, weight=0, minsize=10)
    self.grid_rowconfigure(2, weight=0, minsize=10)
    self.grid_rowconfigure(3, weight=0, minsize=10)
    self.grid_rowconfigure(4, weight=1, minsize=5)

    # build up the body.

    # Column headers

    self.user_label = Label(self,text='Username:'******'w')

    self.user_value = Text(self, width=20, height=1, text="")
    self.user_value.grid(row=1, column=2,  padx=5, pady=5, sticky='w')


    self.pswd_label = Label(self,text='Password:'******'w')

    self.pswd_value = Text(self, width=20, height=1, text="")
    self.pswd_value.grid(row=2, column=2,  padx=5, pady=5, sticky='w')

    
    self.cancel_button = Button(self, width=10, height=1,
                               text="Cancel",
                               command=self.quit )
    self.cancel_button.grid(row=3, column=1,  padx=5, pady=5, sticky='e')

    
    self.login_botton = Button(self, width=10, height=1,
                               text="Login",
                               command=self.login )
    self.login_botton.grid(row=3, column=2,  padx=5, pady=5, sticky='w')
Example #8
0
    def __init__(self,
                 parent,
                 width=70,
                 height=20,
                 xscroll=False,
                 yscroll=True,
                 *args,
                 **kw):

        apply(Frame.__init__, (self, parent) + args, kw)

        self.grid_columnconfigure(1, weight=1)

        row = 0
        texts = ('back', 'forward', 'load')
        commands = (self.prevUrl, self.nextUrl, self.loadUrl)
        self.buttons = ButtonList(self, texts=texts, commands=commands)
        self.buttons.grid(row=row, column=0)
        self.url_entry = Entry(self, returnCallback=self.loadUrl)
        self.url_entry.grid(row=row, column=1, columnspan=2, sticky=Tkinter.EW)
        row = row + 1

        frame = Frame(self)
        frame.grid(row=row, column=0, columnspan=3, sticky=Tkinter.W)
        self.createFindFrame(frame)
        row = row + 1

        self.grid_rowconfigure(row, weight=1)
        self.help_text = ScrolledHtml(self,
                                      width=width,
                                      height=height,
                                      xscroll=xscroll,
                                      yscroll=yscroll,
                                      startUrlCallback=self.startOpenUrl,
                                      endUrlCallback=self.endOpenUrl,
                                      enterLinkCallback=self.setLinkLabel,
                                      leaveLinkCallback=self.setLinkLabel)
        self.help_text.grid(row=row,
                            column=0,
                            columnspan=3,
                            sticky=Tkinter.NSEW)
        row = row + 1

        self.link_label = Label(self)
        self.link_label.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W)
        button = memops.gui.Util.createDismissButton(self,
                                                     dismiss_cmd=self.close)
        button.grid(row=row, column=2)

        self.urls = []
        self.current = -1
        self.updateUrlList = True

        self.setButtonState()
Example #9
0
class Separator(Frame):
  
  refresh  = 0

  def __init__(self, parent, orient = Tkinter.HORIZONTAL, relief='solid', color='black',
               bgColor = 'grey', *args, **kw):

    if (orient == Tkinter.HORIZONTAL):
      size = kw.get('height', 1)
    else:
      size = kw.get('width', 1)
      
    if relief =='solid':
      kw['relief'] = 'flat'
    else:
      kw['relief'] = relief
    
    
    kw['borderwidth'] = (size-1)/2
    
    apply(Frame.__init__, (self, parent) + args, kw)

    self.config(bg=color)
    self.relief = relief

    if self.relief in ('solid','flat'):
      color2 = bgColor
    else:
      color2 = color
 
    self.grid_columnconfigure(0, weight=1)
    self.grid_rowconfigure(0, weight=1)
    self.innerFrame = Frame(self, borderwidth=0, bg=color2)
    self.innerFrame.grid(sticky = Tkinter.NSEW)     
    self.innerFrame.grid_columnconfigure(0, weight=1)
    self.innerFrame.grid_rowconfigure(0, weight=1)
 
  # color is a tuple
  def setColor(self, color, bgColor='grey'):

    if type(color) is type(()) :
      (r,g,b) = color
      color   = hexRepr(r,g,b)
      
    if type(bgColor) is type(()) :
      (r,g,b) = bgColor
      bgColor = hexRepr(r,g,b)
    
    self.config(bg = color)
    
    if self.relief in ('solid','flat'):
      self.innerFrame.config(bg = bgColor)
    else:
      self.innerFrame.config(bg = color)
Example #10
0
    def __init__(self,
                 parent,
                 label='',
                 world_region=None,
                 view_region=None,
                 orient=Tkinter.HORIZONTAL,
                 allow_resize=True,
                 width=20,
                 callback=None,
                 borderwidth=1,
                 show_text=True,
                 text_color='#000000',
                 text_decimals=2,
                 units_scroll=0.1,
                 pages_scroll=1.0,
                 menu_entries=None,
                 menu_callback=None,
                 min_thickness=None,
                 *args,
                 **kw):

        self.menu_entries = menu_entries
        self.myCallback = callback

        Frame.__init__(self, parent, *args, **kw)

        self.text_decimals = text_decimals

        self.label = Label(self, text=label, width=4)

        self.menu = PulldownMenu(self,
                                 callback=menu_callback,
                                 entries=menu_entries)

        self.entry = FloatEntry(self,
                                width=6,
                                returnCallback=self.adjustScrollbar)

        self.region_scrollbar = RegionScrollbar(self,
                                                world_region=world_region,
                                                view_region=view_region,
                                                orient=orient,
                                                allow_resize=allow_resize,
                                                width=width,
                                                callback=self.doCallback,
                                                borderwidth=borderwidth,
                                                show_text=show_text,
                                                text_color=text_color,
                                                text_decimals=text_decimals,
                                                units_scroll=units_scroll,
                                                pages_scroll=pages_scroll,
                                                min_thickness=min_thickness)

        self.gridAll()
Example #11
0
    def __init__(self,
                 parent,
                 callback=None,
                 toggled=True,
                 radio=False,
                 objects=None,
                 selected=None,
                 labels=None,
                 colors=None,
                 fonts=None,
                 maxRowObjects=18,
                 toggledBg='grey75',
                 toggledFg='grey30',
                 font=None,
                 sticky='ew',
                 buttonBorderWidth=1,
                 buttonRelief='raised',
                 docKey=None,
                 tipText=None,
                 *args,
                 **kw):

        Frame.__init__(self,
                       parent,
                       sticky=sticky,
                       docKey=docKey,
                       tipText=tipText,
                       createToolTip=True,
                       *args,
                       **kw)

        # NOTE: toggledBg and toggledFg can be set to None for no change
        # callback should take object

        self.radio = radio
        self.callback = callback
        self.toggled = toggled
        self.toggledFg = toggledFg
        self.toggledBg = toggledBg
        self.state = []
        self.objects = objects
        self.labels = labels
        self.colors = colors
        self.fonts = fonts
        self.maxRowObjects = maxRowObjects
        self.buttonBorderWidth = buttonBorderWidth
        self.buttonRelief = buttonRelief
        self.font = font or 'Helvetica 10'
        self.waiting = False

        self.buttons = []

        self.update(objects=objects, labels=labels, selected=selected)
Example #12
0
    def __init__(self,
                 parent,
                 labels=None,
                 entries=None,
                 separator=': ',
                 label_width=20,
                 entry_width=60,
                 label_anchor=Tkinter.E,
                 show=None,
                 frozen=None,
                 returnCallback=None,
                 put_in_row=False,
                 *args,
                 **kw):

        self.separator = separator
        self.label_width = label_width
        self.entry_width = entry_width
        self.label_anchor = label_anchor
        self.put_in_row = put_in_row
        self.returnCallback = returnCallback

        if (entries is None):
            entries = len(labels) * ['']

        nentries = len(entries)

        if (labels is None):
            labels = nentries * ['']

        assert len(labels) == nentries, '%d vs %d' % (len(labels), nentries)

        if (show is None):
            show = nentries * ['']

        if (frozen is None):
            frozen = nentries * [False]

        Frame.__init__(self, parent, *args, **kw)

        self.labels = []
        self.entries = []

        for n in range(nentries):
            self.addLabelEntry(n,
                               labels[n],
                               entries[n],
                               show[n],
                               frozen[n],
                               doGrid=False)

        self.gridAll()
    def body(self, guiFrame):
        '''Describes where all the GUI element are.'''

        self.geometry('400x500')
        guiFrame.expandGrid(0, 0)
        tableFrame = Frame(guiFrame)
        tableFrame.grid(
            row=0,
            column=0,
            sticky='nsew',
        )
        tableFrame.expandGrid(0, 0)
        buttonFrame = Frame(guiFrame)
        buttonFrame.grid(
            row=1,
            column=0,
            sticky='nsew',
        )
        headingList = ['Spinsystem Number', 'Assignment', 'Residue Type Probs']
        self.table = ScrolledMatrix(tableFrame,
                                    headingList=headingList,
                                    callback=self.updateSpinSystemSelection,
                                    multiSelect=True)
        self.table.grid(row=0, column=0, sticky='nsew')
        texts = ['Add Prob']
        commands = [self.addProb]
        self.AddProbButton = ButtonList(buttonFrame,
                                        commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=0, sticky='nsew')
        texts = ['Remove Prob']
        commands = [self.removeProb]
        self.AddProbButton = ButtonList(buttonFrame,
                                        commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=2, sticky='nsew')
        selectCcpCodes = sorted(self.chemCompDict.keys())
        tipText = 'select ccpCode'
        self.selectCcpCodePulldown = PulldownList(buttonFrame,
                                                  texts=selectCcpCodes,
                                                  grid=(0, 1),
                                                  tipText=tipText)

        selectCcpCodes = ['All Residue Types']

        tipText = 'select ccpCode'
        self.selectCcpCodeRemovePulldown = PulldownList(buttonFrame,
                                                        texts=selectCcpCodes,
                                                        index=0,
                                                        grid=(0, 3),
                                                        tipText=tipText)
        self.updateTable()
Example #14
0
    def __init__(self, guiParent, dataText, dataObjects, dataValues, helpText,
                 selectionText, **kw):

        Frame.__init__(self, guiParent, **kw)

        label = Label(self, text=dataText + ':', grid=(0, 0))
        self.selectionList = PulldownList(self,
                                          objects=dataObjects,
                                          texts=dataValues,
                                          grid=(0, 1))
        label = Label(self, text=helpText, grid=(1, 0), gridSpan=(1, 2))
        label = Label(self, text=selectionText + ':', grid=(2, 0))
        self.selectionEntry = Entry(self, grid=(2, 1))
Example #15
0
  def __init__(self, parent, callback, speed = 1.5, delay = 50,
               fill = 'grey73', outline = 'grey90', hilight='grey90',
               width = 144, height = 24, *args, **kw):

    self.callback = callback
    self.speed   = speed
    self.delay   = delay
    self.fill    = fill
    self.outline = outline
    self.hilight = hilight

    Frame.__init__(self, parent=parent, *args, **kw)

    # if canvas width/height fixed then resizing has no effect, it seems
    #self.grid_rowconfigure(0, weight=1)
    #self.grid_columnconfigure(0, weight=1)
    font = '-schumacher-clean-bold-r-normal--14-140-75-75-c-70-iso646.1991-irv'
    self.canvas = c = Canvas(self, width=width, height=height, relief='flat', borderwidth=0)
    c.bind('<Configure>', self.resize)
    c.bind('<ButtonPress>', self.press)
    c.bind('<Motion>', self.motion)
    c.bind('<Enter>', self.mouseEnter)
    c.bind('<Leave>', self.mouseLeave)
    c.bind('<ButtonRelease>', self.release)
    self.bg      = c.create_rectangle(1, 1, 1, 1, fill='red', outline='grey50')
    self.boxes0   = []
    self.boxes1   = []
    self.boxes2   = []
    self.strikes  = []
    self.dashes   = []

    for n in range(24):
      box1    = c.create_rectangle(0, 0, 0, 0, fill=outline, outline=outline)
      box2    = c.create_rectangle(0, 0, 0, 0, fill=outline, outline=outline)
      box0    = c.create_rectangle(0, 0, 0, 0, fill=outline, outline=outline)
      self.boxes0.append(box0) 
      self.boxes1.append(box1) 
      self.boxes2.append(box2) 
     
    for n in range(8):
      dash    = c.create_line(0,0,0,0,fill='black')
      self.dashes.append( dash )

    for n in range(4):
      strike = c.create_line(0,0,0,0,fill='black')
      self.strikes.append( strike  )
     
    c.grid(row=0, column=0, sticky=Tkinter.NSEW)

    self.continue_callback = False
    self.multiplier = 1.0
Example #16
0
    def __init__(self,
                 parent,
                 options,
                 selected=0,
                 toggleOff=False,
                 relief='raised',
                 callback=None,
                 font='Helvetica 10',
                 docKeys=None,
                 tipTexts=None,
                 *args,
                 **kw):

        Frame.__init__(self, parent, *args, **kw)

        self.selected = selected
        self.options = options
        self.tipTexts = tipTexts
        self.docKeys = docKeys
        self.font = font
        self.callback = callback
        self.bg = self.cget('bg')
        self.toggleOff = toggleOff
        self.inactColor = '#D0C8C0'
        self._frameCache = []
        self.sideFrame = None

        self.toolTip = ToolTip(self, text='')

        if relief == 'sunken':
            self.edge1Color = 'grey60'
            self.inlayColor = '#D0B0A0'
            self.edge2Color = 'white'
        else:
            self.edge1Color = 'white'
            self.inlayColor = '#D0B0A0'
            self.edge2Color = 'grey60'

        self.canvas = Tkinter.Canvas(self,
                                     highlightbackground=self.bg,
                                     background=self.bg,
                                     width=1,
                                     height=1)
        self.canvas.grid()

        self.setTabs(options, selected, tipTexts, docKeys)

        self.canvas.bind('<Button-1>', self.mouseClick)
        self.canvas.bind('<Button-2>', self.mouseClick)
        self.canvas.bind('<Button-3>', self.mouseClick)
        self.bind('<Configure>', self.redraw)
Example #17
0
  def body(self, guiParent):

    # Ensure that the first row and column in popup expand
    guiParent.grid_rowconfigure(1, weight=1)
    guiParent.grid_columnconfigure(0, weight=1, minsize=200)
    frame = Frame(guiParent) # Body widgets can be put in this frame
    frame.grid(row=1, column=0, sticky='nsew')
    
    frame.grid_rowconfigure(0, weight=1)
    frame.grid_columnconfigure(0, weight=1, minsize=200)

    self.dangleFrame = DangleFrame(frame, self, project=self.project)
    self.dangleFrame.grid(row=0, column=0, sticky='nsew')

    # Dictionary to store popups opened by this application - e.g. need to close upon quit
    self.popups = {}
    
    # Default font
    self.font   = 'Helvetica 10'

    # Closing the window from the desktop environment calls the proper quit
    self.protocol('WM_DELETE_WINDOW', self.quit)

    self.mainMenu    = Menu(self)
    self.projectMenu = self.makeProjectMenu()
    self.viewMenu    = self.viewFileMenu()
    self.otherMenu   = self.makeAppearanceMenu()
    
    # Put the main menu 
    self.config(menu=self.mainMenu)

    self.initProject()
Example #18
0
  def __init__(self, parent, callback=None, texts=None, objects=None,
               categories=None, colors=None, index=0, prefix='', indent='',
               initCallback=False, forceCallback=False, numbering=False,   
               arrowLine='#602000', arrowFill='#B05848', labelColor='#501000',
               menuBg='#F0F0FF', sticky='w', docKey=None, tipText=None,
               categoriesLast=True, *args, **kw):

    Frame.__init__(self, parent, sticky=sticky, docKey=docKey, tipText=tipText, createToolTip=True, *args, **kw)

    self.callback      = callback
    self.texts         = texts or []
    self.objects       = objects or []
    self.categories    = categories or []
    self.colors        = colors or []
    self.prefix        = prefix
    self.indent        = indent
    self.initCallback  = initCallback
    self.numbering     = numbering
    self.arrowLine     = arrowLine
    self.arrowFill     = arrowFill
    self.labelColor    = labelColor
    self.active        = True
    self.categoriesLast = categoriesLast
    
    # Current selection
    self.index         = None
    self.object        = NullText
    
    self.rows   = []
    self.bg     = self.cget('bg')
    self.label  = Label(self, foreground=labelColor)
    self.canvas = Canvas(self, width=12, height=12, background=self.bg)
    self.menu   = Menu(self.canvas, tearoff=False, bg=menuBg, relief='solid',
                       borderwidth=1, activeborderwidth=1)
    
    self.menu.images = [] # Photoimage has to remain referenced

    self.setup(self.texts, self.objects, index,
               self.colors, self.categories)

    self.label.bind( "<Button-1>",  self._labelClick)
    self.menu.bind(  "<Leave>",     self._leave)
    self.canvas.bind("<Button-1>",  self._canvasClick)
    self.canvas.bind("<Configure>", self._resizeCallback)

    self.grid_columnconfigure(0, weight=1)
    self.label.grid(row=0, column=0, sticky='w')
    self.canvas.grid(row=0, column=1, sticky='w', padx=2)
Example #19
0
    def body(self, guiFrame):

        self.geometry('700x400')

        guiFrame.grid_columnconfigure(0, weight=1)
        guiFrame.grid_rowconfigure(0, weight=1)

        interfaceGroups, interfaceGroupDict = self.getInterfaceGroups()

        if len(interfaceGroups) > 1:
            mainFrame = TabbedFrame(guiFrame,
                                    options=interfaceGroups,
                                    grid=(0, 0))
            frames = mainFrame.frames
        else:
            mainFrame = Frame(guiFrame, grid=(0, 0))
            frames = [mainFrame]

        for n, interfaceGroup in enumerate(interfaceGroups):
            frame = frames[n]

            interfaceObjects = interfaceGroupDict[interfaceGroup]
            for interfaceObject in interfaceObjects:
                self.makeInterfaceWidget(frame, interfaceObject)

        texts = ('Ok', 'Cancel')
        commands = (self.setupRun, self.cancelRun)
        buttonList = ButtonList(guiFrame,
                                texts=texts,
                                commands=commands,
                                grid=(1, 0))
    def destroy(self):

        notify = self.application.unregisterNotify
        for func in ('__init__', 'delete'):
            notify(self.updateAfter, 'ccp.nmr.Nmr.PeakList', func)
            notify(self.updateConstraintSets,
                   'ccp.nmr.NmrConstraint.NmrConstraintStore', func)
            notify(self.updateMolSystems, 'ccp.molecule.MolSystem.MolSystem',
                   func)
            notify(self.updateMolSystems, 'ccp.molecule.MolSystem.Chain', func)

        for func in ('__init__', 'delete', 'setName'):
            notify(self.updateAfter, 'ccp.nmr.Nmr.Experiment', func)
            notify(self.updateAfter, 'ccp.nmr.Nmr.DataSource', func)

        Frame.destroy(self)
Example #21
0
  def __init__(self, guiParent, basePopup):
    # Base popup required to handle notification of data model changes
    # e.g. new peak lists, so that the GUI can update to the latest
    # state
    self.basePopup = basePopup
    self.guiParent = guiParent

    self.basePopup.frameShortcuts['Workflow'] = self

    #self.registerNotify=basePopup.registerNotify
    #self.unregisterNotify=basePopup.unregisterNotify

    Frame.__init__(self, guiParent)
  
    self.grid_rowconfigure(0, weight=0)
    self.grid_rowconfigure(1, weight=0, minsize=100)
    self.grid_rowconfigure(2, weight=1)
    self.grid_rowconfigure(3, weight=0, minsize=30)
    
    self.grid_columnconfigure(0, weight=0)
    self.grid_columnconfigure(1, weight=1)
    self.grid_columnconfigure(2, weight=0)

    # build up the body.

    self.lcA = LinkChart(self, background='#8080B0', height=110)
    self.lcB = LinkChart(self, background='#8080B0')

    lcButtonOpts=['Load','Save','Clear','New Protocol']
    lcButtonCmds=[self.tmpCall,self.tmpCall,self.tmpCall,self.tmpCall]
    self.lcButtons = ButtonList(self, lcButtonOpts, lcButtonCmds)

    # hack for now. This should come from db of meta-tasks
    self.expts=['Test1','Test2','ARIA','CING','ISD']

    # needs custom version
    self.filter = FilterFrame(self, self.basePopup, text='Filter')

    # no bean udnerneath for now so mock up nodes    
    self.wfTree = Tree(self, width=35)

    wfButtonOpts=['Load','Save']
    wfButtonCmds=[self.tmpCall,self.tmpCall]
    self.wfButtons = ButtonList(self, wfButtonOpts, wfButtonCmds)
    

    self.drawFrame()
Example #22
0
    def __init__(self,
                 parent,
                 borderRelief='raised',
                 text=' ',
                 justify='left',
                 font=None,
                 sticky='ew',
                 docKey=None,
                 tipText=None,
                 *args,
                 **kw):

        Frame.__init__(self, parent, sticky=sticky, *args, **kw)

        self.borderRelief = borderRelief
        self.bg = self.cget('bg')
        self.justify = justify
        self.canvas1 = Canvas(self, background=self.bg)

        if self.borderRelief == 'sunken':
            fill1 = 'grey60'
            fill2 = 'white'
        else:
            fill1 = 'white'
            fill2 = 'grey60'
        fill3 = 'grey85'

        self.label = Label(self,
                           text=text,
                           font=font,
                           docKey=docKey,
                           tipText=tipText)
        self.label.grid()

        self.canvasL = [
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill1),
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill2),
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill3)
        ]

        self.canvasR = [
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill1),
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill2),
            self.canvas1.create_rectangle(0, 0, 0, 0, width=0, fill=fill3)
        ]

        self.bind('<Configure>', self.resize)
Example #23
0
    def __init__(self, title, message, texts, objects=None, parent=None):

        if parent is None:
            parent = Tkinter.Tk()
            #parent.withdraw()
            self.root = parent
            parent.protocol('WM_DELETE_WINDOW', self.destroy)

        else:
            self.root = None

        Tkinter.Toplevel.__init__(self, parent)

        self.resizable(0, 0)
        self.parent = parent
        self.title(title)
        self.var = Tkinter.IntVar()
        self.objects = objects or range(len(texts))

        assert len(self.objects) == len(texts)

        x = parent.winfo_rootx() + parent.winfo_width() / 2
        y = parent.winfo_rooty() + parent.winfo_height() / 2
        location = '+%d+%d' % (x, y)

        if hasattr(parent, 'font'):
            self.font = parent.font
        else:
            self.font = None

        Tkinter.Toplevel.geometry(self, location)
        Tkinter.Toplevel.lift(self, parent)
        self.update_idletasks()
        self.transient(parent)

        self.protocol('WM_DELETE_WINDOW', self._null)
        self.focus_force()
        self.grab_set()

        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)

        label = Label(self, text=message, grid=(0, 0))
        self.config(bg=label.cget('bg'))

        frame = Frame(self, grid=(1, 0))

        _buttons = []
        for i, text in enumerate(texts):
            button = Button(frame,
                            text=text,
                            command=lambda j=i: self._click(j))
            button.grid(row=i + 1, column=0, padx=2, pady=2, sticky='ew')
            if objects[i] is None:
                button.config(bg='#B0FFB0')
            _buttons.append(button)

        self._wait()
Example #24
0
    def __init__(self,
                 parent,
                 residue=None,
                 resizeCallback=None,
                 project=None,
                 tipText=None,
                 shiftList=None,
                 *args,
                 **kw):

        self.shiftList = shiftList

        Frame.__init__(self, parent, *args, **kw)

        self.grid_columnconfigure(2, weight=1)

        row = 0
        self.label = Label(self, text='', grid=(row, 0))

        self.assignSelect = CheckButton(
            self,
            callback=self.setDisplayAssign,
            grid=(row, 1),
            tipText='Whether to show chemical shifts of assigned atoms')

        label0 = Label(self, text='Show Assignments', grid=(row, 2))

        row += 1
        self.grid_rowconfigure(row, weight=1)
        self.varFrame = ViewChemCompVarFrame(self,
                                             chemCompVar=self.chemCompVar,
                                             project=project,
                                             tipText=tipText,
                                             grid=(row, 0),
                                             gridSpan=(1, 3))

        self.assignSelect.set(True)
Example #25
0
    def createFindFrame(self, master):

        frame = Frame(master)
        frame.grid(row=0, column=0, sticky=Tkinter.W)

        arrow = ToggleArrow(frame, callback=self.toggleFindFrame)
        arrow.grid(row=0, column=0)
        button = Button(frame, text='find:', command=self.findPhrase)
        button.grid(row=0, column=1)
        self.find_entry = Entry(frame,
                                width=20,
                                returnCallback=self.findPhrase)
        self.find_entry.grid(row=0, column=2)

        self.find_frame = frame = Frame(master)

        entries = ('search forwards', 'search backwards')
        self.direction_buttons = PulldownMenu(frame, entries=entries)
        self.direction_buttons.grid(row=0, column=0, sticky=Tkinter.W, padx=5)

        self.forwards_entries = entries = ('wrap search', 'stop at end')
        self.backwards_entries = ('wrap search', 'stop at beginning')
        self.wrap_buttons = PulldownMenu(frame, entries=entries)
        self.wrap_buttons.grid(row=0, column=1, sticky=Tkinter.W, padx=5)

        self.direction_buttons.callback = self.setWrapText

        entries = ('case insensitive', 'case sensitive')
        self.case_buttons = PulldownMenu(frame, entries=entries)
        self.case_buttons.grid(row=0, column=2, sticky=Tkinter.W, padx=5)

        entries = ('literal search', 'regex search')
        self.pattern_buttons = PulldownMenu(frame, entries=entries)
        self.pattern_buttons.grid(row=0, column=3, sticky=Tkinter.W, padx=5)

        self.countVar = Tkinter.IntVar()
    def body(self, guiFrame):
        '''Describes where all the GUI element are.'''

        self.geometry('400x500')
        guiFrame.expandGrid(0, 0)
        tableFrame = Frame(guiFrame)
        tableFrame.grid(row=0, column=0, sticky='nsew', )
        tableFrame.expandGrid(0, 0)
        buttonFrame = Frame(guiFrame)
        buttonFrame.grid(row=1, column=0, sticky='nsew', )
        headingList = ['Spinsystem Number', 'Assignment', 'Residue Type Probs']
        self.table = ScrolledMatrix(tableFrame, headingList=headingList,
                                    callback=self.updateSpinSystemSelection,
                                    multiSelect=True)
        self.table.grid(row=0, column=0, sticky='nsew')
        texts = ['Add Prob']
        commands = [self.addProb]
        self.AddProbButton = ButtonList(buttonFrame, commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=0, sticky='nsew')
        texts = ['Remove Prob']
        commands = [self.removeProb]
        self.AddProbButton = ButtonList(buttonFrame, commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=2, sticky='nsew')
        selectCcpCodes = sorted(self.chemCompDict.keys())
        tipText = 'select ccpCode'
        self.selectCcpCodePulldown = PulldownList(buttonFrame,
                                                  texts=selectCcpCodes,
                                                  grid=(0, 1),
                                                  tipText=tipText)

        selectCcpCodes = ['All Residue Types']

        tipText = 'select ccpCode'
        self.selectCcpCodeRemovePulldown = PulldownList(buttonFrame,
                                                        texts=selectCcpCodes,
                                                        index=0,
                                                        grid=(0, 3),
                                                        tipText=tipText)
        self.updateTable()
Example #27
0
    def __init__(self,
                 parent,
                 texts,
                 commands,
                 images=None,
                 buttonBorderwidth=1,
                 spacers=1,
                 expands=True,
                 font=None,
                 direction=HORIZONTAL,
                 sticky='ew',
                 *args,
                 **kw):

        assert direction in (HORIZONTAL,
                             VERTICAL), 'direction = %s' % direction

        if (type(commands) is types.DictType):
            have_dict = True
            for key in commands.keys():
                assert key in texts, 'key = %s' % key
        else:
            have_dict = False
            assert len(texts) == len(
                commands), 'len(texts) = %s, len(commands) = %s' % (
                    len(texts), len(commands))

        if not kw.has_key('bg'):
            kw['bg'] = 'grey82'

        Frame.__init__(self, parent, sticky=sticky, *args, **kw)

        if (direction == Tkinter.HORIZONTAL):
            self.grid_rowconfigure(0, weight=1)
        else:
            self.grid_columnconfigure(0, weight=1)

        if images is None:
            images = [None] * len(texts)

        self.font = font
        self.spacers = spacers
        r = 0
        c = 0

        if expands:
            self.spacers = spacers = 0
            for i in range(len(texts)):
                if texts[i]:
                    if (direction == Tkinter.HORIZONTAL):
                        self.grid_columnconfigure(i, weight=1)
                    else:
                        self.grid_rowconfigure(i, weight=1)

        else:
            if spacers and (direction == Tkinter.HORIZONTAL):
                self.grid_columnconfigure(c, weight=1)
                self.grid_columnconfigure(len(texts) + 1, weight=1)
                spacer1 = Spacer(self)
                spacer2 = Spacer(self)
                spacer1.grid(row=r, column=c, sticky=Tkinter.NSEW)
                spacer2.grid(row=r, column=len(texts) + 1, sticky=Tkinter.NSEW)
                c += 1

        self.buttons = []
        bg = kw['bg']

        for n, text in enumerate(texts):

            if n < len(images):
                image = images[n]
            else:
                image = None

            if type(text) not in (STRING_TYPE, UNICODE_TYPE):
                text = str(text)

            if (have_dict):
                try:
                    command = commands[text]
                except:
                    command = lambda x=text: notYetImplemented(x)
            else:
                command = commands[n]
                if not command:
                    command = lambda x=text: notYetImplemented(x)

            button = Button(self,
                            text=text,
                            command=command,
                            bg=bg,
                            image=image,
                            borderwidth=buttonBorderwidth,
                            font=self.font)
            button.grid(row=r, column=c, sticky=Tkinter.NSEW)
            self.buttons.append(button)

            if direction == Tkinter.HORIZONTAL:
                c = c + 1
            else:
                r = r + 1
Example #28
0
    def __init__(self,
                 parent,
                 xscroll=True,
                 yscroll=True,
                 width=500,
                 height=500,
                 doExtraConfig=True,
                 tipText=None,
                 *args,
                 **kw):

        Frame.__init__(self, parent, *args, **kw)

        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.doExtraConfig = doExtraConfig
        self.xscroll = xscroll
        self.yscroll = yscroll

        self.canvas = Tkinter.Canvas(self,
                                     borderwidth=0,
                                     bg=self.cget('bg'),
                                     highlightthickness=0,
                                     width=25,
                                     height=25)
        self.canvas.grid(row=0, column=0, sticky=Tkinter.NSEW)

        if (xscroll):
            self.xscrollbar = Tkinter.Scrollbar(self,
                                                orient=Tkinter.HORIZONTAL,
                                                borderwidth=1)
            self.xscrollbar.config(command=self.canvas.xview)
            self.canvas.config(xscrollcommand=self.xscrollbar.set)

        if (yscroll):
            self.yscrollbar = Tkinter.Scrollbar(self,
                                                orient=Tkinter.VERTICAL,
                                                borderwidth=1)
            self.yscrollbar.config(command=self.canvas.yview)
            self.canvas.config(yscrollcommand=self.yscrollbar.set)

        # reset the view (always do this if you don't use scrollbars)
        self.canvas.xview('moveto', 0)
        self.canvas.yview('moveto', 0)

        # create the frame
        self.frame = Frame(self.canvas, tipText=tipText)
        self.frame.grid(row=0, column=0, sticky=Tkinter.NSEW)
        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)
        self.waiting = 0

        # track changes to its size
        self.bind('<Configure>', self.configureCanvasAfter)

        # track changes to its contents
        self.frame.bind('<Configure>', self.configureFrame)

        # place the frame inside the canvas (this also
        # runs the __configure method)
        self.canvas.create_window(0, 0, window=self.frame, anchor='nw')
        #self.frameWidth  = self.frame.winfo_reqwidth()
        #self.frameHeight = self.frame.winfo_reqheight()
        self.frameWidth = 0
        self.frameHeight = 0
Example #29
0
class ScrolledFrame(Frame):
    def __init__(self,
                 parent,
                 xscroll=True,
                 yscroll=True,
                 width=500,
                 height=500,
                 doExtraConfig=True,
                 tipText=None,
                 *args,
                 **kw):

        Frame.__init__(self, parent, *args, **kw)

        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.doExtraConfig = doExtraConfig
        self.xscroll = xscroll
        self.yscroll = yscroll

        self.canvas = Tkinter.Canvas(self,
                                     borderwidth=0,
                                     bg=self.cget('bg'),
                                     highlightthickness=0,
                                     width=25,
                                     height=25)
        self.canvas.grid(row=0, column=0, sticky=Tkinter.NSEW)

        if (xscroll):
            self.xscrollbar = Tkinter.Scrollbar(self,
                                                orient=Tkinter.HORIZONTAL,
                                                borderwidth=1)
            self.xscrollbar.config(command=self.canvas.xview)
            self.canvas.config(xscrollcommand=self.xscrollbar.set)

        if (yscroll):
            self.yscrollbar = Tkinter.Scrollbar(self,
                                                orient=Tkinter.VERTICAL,
                                                borderwidth=1)
            self.yscrollbar.config(command=self.canvas.yview)
            self.canvas.config(yscrollcommand=self.yscrollbar.set)

        # reset the view (always do this if you don't use scrollbars)
        self.canvas.xview('moveto', 0)
        self.canvas.yview('moveto', 0)

        # create the frame
        self.frame = Frame(self.canvas, tipText=tipText)
        self.frame.grid(row=0, column=0, sticky=Tkinter.NSEW)
        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)
        self.waiting = 0

        # track changes to its size
        self.bind('<Configure>', self.configureCanvasAfter)

        # track changes to its contents
        self.frame.bind('<Configure>', self.configureFrame)

        # place the frame inside the canvas (this also
        # runs the __configure method)
        self.canvas.create_window(0, 0, window=self.frame, anchor='nw')
        #self.frameWidth  = self.frame.winfo_reqwidth()
        #self.frameHeight = self.frame.winfo_reqheight()
        self.frameWidth = 0
        self.frameHeight = 0

    def configureFrame(self, event):

        # frame contents have changed size, but make no change to displayed canvas size
        if (event.width != self.frameWidth) or (event.height !=
                                                self.frameHeight):

            # the size of the frame with widgets in the 'background'
            self.frameWidth = event.width
            self.frameHeight = event.height

            # the scrolled region is always the entire frame
            self.canvas.config(scrollregion="0 0 %s %s" %
                               (self.frameWidth, self.frameHeight))

            self.configureCanvasAfter()

    def configureCanvasAfter(self, event=None):

        if self.waiting:
            return

        else:
            self.waiting = 1
            self.after_idle(lambda: self.configureCanvas(event))

    def configureCanvas(self, event=None):

        d = 2 * int(self.cget('borderwidth'))
        if (event):
            # the canvas visible display size updates with the rezize event unless the axis is not scrolled
            canvasWidth = event.width - d
            canvasHeight = event.height - d

        else:
            # if no resize event the canvas size is unaltered
            canvasWidth = int(self.winfo_width()) - d
            canvasHeight = int(self.winfo_height()) - d

        if self.xscroll:
            if (self.frameWidth > 1):
                if (self.frameWidth > canvasWidth):
                    self.xscrollbar.grid(row=1, column=0, sticky=Tkinter.EW)
                else:
                    self.xscrollbar.grid_forget()
            else:
                self.xscrollbar.grid(row=1, column=0, sticky=Tkinter.EW)
        else:
            # display full width
            canvasWidth = self.frameWidth

        if self.yscroll:
            if (self.frameHeight > 1):
                if (self.frameHeight > canvasHeight):
                    self.yscrollbar.grid(row=0, column=1, sticky=Tkinter.NS)
                else:
                    self.yscrollbar.grid_forget()
            else:
                self.yscrollbar.grid(row=0, column=1, sticky=Tkinter.NS)
        else:
            # display full height
            canvasHeight = self.frameHeight

        if (self.doExtraConfig):
            # sometimes below seems to be needed and sometimes not
            # seems to depend on what else is there in widget besides scrolled frame
            # can sometimes wildly iterate if below is done
            self.canvas.config(width=canvasWidth, height=canvasHeight)
        self.waiting = 0
Example #30
0
    import Util

    def config1(event):
        print 'config1:', frame.winfo_width(), frame.winfo_height()

    def config2(event):
        print 'config2:', frame2.winfo_width(), frame2.winfo_height()

    root = Tkinter.Tk()

    frame = ScrolledFrame(root)
    #frame = ScrolledFrame(root, xscroll=false)
    # below must be pack not grid in order for expansion to work
    frame.pack(side=Tkinter.TOP, expand=Tkinter.YES, fill=Tkinter.BOTH)
    frame.bind('<Configure>', config1)

    frame2 = Frame(frame.frame)
    frame2.bind('<Configure>', config2)

    for i in range(30):
        t = 'a very long label %s' % i
        label = Tkinter.Label(frame2, text=t)
        label.grid(sticky=Tkinter.NSEW)

    frame2.grid(sticky=Tkinter.NSEW)

    button = Util.createQuitButton(root)
    button.pack()

    root.mainloop()
Example #31
0
  def body(self, guiFrame):

    self.geometry("500x500")

    self.nameEntry  = Entry(self, text='', returnCallback=self.setName,    width=12)
    self.detailsEntry = Entry(self, text='', returnCallback=self.setDetails, width=16)
    self.valueEntry = FloatEntry(self, text='', returnCallback=self.setValue, width=10)
    self.errorEntry = FloatEntry(self, text='', returnCallback=self.setError, width=8)
    
    self.conditionNamesPulldown = PulldownList(self, callback=self.setConditionName,
                                               texts=self.getConditionNames())
    self.unitPulldown = PulldownList(self, callback=self.setUnit,
                                     texts=self.getUnits())
    self.experimentPulldown = PulldownList(self, callback=self.setExperiment)

    guiFrame.grid_columnconfigure(0, weight=1)

    row = 0
    frame = Frame(guiFrame, grid=(row, 0))
    frame.expandGrid(None,0)
    div = LabelDivider(frame, text='Current Series', grid=(0, 0))
    utilButtons = UtilityButtonList(frame, helpUrl=self.help_url, grid=(0,1))

    row += 1
    frame0 = Frame(guiFrame, grid=(row, 0))
    frame0.expandGrid(0,0)
    tipTexts = ['The serial number of the experiment series, but left blank if the series as actually a pseudo-nD experiment (with a sampled non-frequency axis)',
                'The name of the experiment series, which may be a single pseudo-nD experiment',
                'The number of separate experiments (and hence spectra) present in the series',
                'The kind of quantity that varies for different experiments/planes within the NMR series, e.g. delay time, temperature, ligand concentration etc.',
                'The number of separate points, each with a separate experiment/plane and parameter value, in the series']
    headingList      = ['#','Name','Experiments','Parameter\nVaried','Num\nPoints']
    editWidgets      = [None, self.nameEntry, None, self.conditionNamesPulldown, None]
    editGetCallbacks = [None, self.getName,   None, self.getConditionName, None]
    editSetCallbacks = [None, self.setName,   None, self.setConditionName, None]
    self.seriesMatrix = ScrolledMatrix(frame0, tipTexts=tipTexts,
                                       editSetCallbacks=editSetCallbacks,
                                       editGetCallbacks=editGetCallbacks,
                                       editWidgets=editWidgets,
                                       headingList=headingList,
                                       callback=self.selectExpSeries,
                                       deleteFunc=self.deleteExpSeries,
                                       grid=(0,0), gridSpan=(None, 3))

    tipTexts = ['Make a new, blank NMR series specification in the CCPN project',
                'Delete the selected NMR series from the project, although any component experiments remain. Note you cannot delete pseudo-nD series; delete the actual experiment instead',
                'Colour the spectrum contours for each experiment in the selected series (not pseudo-nD) using a specified scheme']
    texts    = ['Add Series','Delete Series',
                'Auto Colour Spectra']
    commands = [self.addExpSeries,self.deleteExpSeries,
                self.autoColorSpectra]
                
    self.seriesButtons = ButtonList(frame0, texts=texts, commands=commands,
                                    grid=(1,0), tipTexts=tipTexts)

    label = Label(frame0, text='Scheme:', grid=(1,1))
    
    tipText = 'Selects which colour scheme to apply to the contours of (separate) experiments within an NMR series'
    self.colorSchemePulldown = PulldownList(frame0, grid=(1,2), tipText=tipText)

    row += 1
    div = LabelDivider(guiFrame, text='Experimental Parameters & Conditions', grid=(row, 0))

    row += 1
    guiFrame.grid_rowconfigure(row, weight=1)
    frame1 = Frame(guiFrame, grid=(row, 0))
    frame1.expandGrid(0,0)
    tipTexts = ['The kind of experimental parameter that is being used to define the NMR series',
                'The experiment that corresponds to the specified parameter value; can be edited from an arbitrary initial experiment',
                'The numeric value of the parameter (condition) that relates to the experiment or point in the NMR series',
                'The estimated error in value of the condition',
                'The measurement unit in which the value of the condition is represented']
    headingList      = ['Parameter','Experiment','Value','Error','Unit']
    editWidgets      = [None,self.experimentPulldown,self.valueEntry,self.errorEntry, self.unitPulldown]
    editGetCallbacks = [None,self.getExperiment,     self.getValue,  self.getError,   self.getUnit]
    editSetCallbacks = [None,self.setExperiment,     self.setValue,  self.setError,   self.setUnit]
    self.conditionPointsMatrix = ScrolledMatrix(frame1, grid=(0,0), tipTexts=tipTexts,
                                                editSetCallbacks=editSetCallbacks,
                                                editGetCallbacks=editGetCallbacks,
                                                editWidgets=editWidgets,
                                                headingList=headingList,
                                                callback=self.selectConditionPoint,
                                                deleteFunc=self.deleteConditionPoint)
    
    self.conditionPointsMatrix.doEditMarkExtraRules = self.conditionTableShow 
    tipTexts = ['Add a new point to the NMR series with an associated parameter value and experiment',
                'Remove the selected point from the series, including any associated parameter value',
                'For appropriate kinds of NMR series, set or unset a point as representing the plane to use as a reference']
    texts    = ['Add Series Point','Delete Series Point','Set/Unset Ref Plane']
    commands = [self.addConditionPoint,self.deleteConditionPoint,self.setSampledReferencePlane]
    self.conditionPointsButtons = ButtonList(frame1, texts=texts, commands=commands,
                                             tipTexts=tipTexts, grid=(1,0))
    
    self.updateAfter()
    self.updateColorSchemes()

    self.administerNotifiers(self.registerNotify)
Example #32
0
  def __init__(self, parent, application, *args, **kw):

    project = application.project
    simStore = project.findFirstNmrSimStore(application=APP_NAME) or \
               project.newNmrSimStore(application=APP_NAME, name=APP_NAME)

    self.application = application
    self.residue = None
    self.structure = None
    self.serverCredentials = None
    self.iCingBaseUrl = DEFAULT_URL
    self.resultsUrl = None
    self.chain = None
    self.nmrProject = application.nmrProject
    self.serverDone = False

    NmrSimRunFrame.__init__(self, parent, project, simStore, *args, **kw)

    # # # # # # New Structure Frame # # # # #

    self.structureFrame.grid_forget()

    tab = self.tabbedFrame.frames[0]

    frame = Frame(tab, grid=(1,0))
    frame.expandGrid(2,1)

    div = LabelDivider(frame, text='Structures', grid=(0,0), gridSpan=(1,2))

    label = Label(frame, text='Ensemble: ', grid=(1,0))
    self.structurePulldown = PulldownList(frame, callback=self.changeStructure, grid=(1,1))

    headingList = ['Model','Use']
    editWidgets      = [None,None]
    editGetCallbacks = [None,self.toggleModel]
    editSetCallbacks = [None,None,]
    self.modelTable = ScrolledMatrix(frame, grid=(2,0), gridSpan=(1,2),
                                     callback=self.selectStructModel,
                                     editWidgets=editWidgets,
                                     editGetCallbacks=editGetCallbacks,
                                     editSetCallbacks=editSetCallbacks,
                                     headingList=headingList)

    texts = ['Activate Selected','Inactivate Selected']
    commands = [self.activateModels, self.disableModels]
    buttons = ButtonList(frame, texts=texts, commands=commands, grid=(3,0), gridSpan=(1,2))


    # # # # # # Submission frame # # # # # #

    tab = self.tabbedFrame.frames[1]
    tab.expandGrid(1,0)

    frame = LabelFrame(tab, text='Server Job Submission', grid=(0,0))
    frame.expandGrid(None,2)

    srow = 0
    label = Label(frame, text='iCing URL:', grid=(srow, 0))
    urls = [DEFAULT_URL,]
    self.iCingBaseUrlPulldown = PulldownList(frame, texts=urls, objects=urls, index=0, grid=(srow,1))


    srow +=1
    label = Label(frame, text='Results File:', grid=(srow, 0))
    self.resultFileEntry = Entry(frame, bd=1, text='', grid=(srow,1), width=50)
    self.setZipFileName()
    button = Button(frame, text='Choose File', bd=1, sticky='ew',
                    command=self.chooseZipFile, grid=(srow, 2))

    srow +=1
    label = Label(frame, text='Results URL:', grid=(srow, 0))
    self.resultUrlEntry = Entry(frame, bd=1, text='', grid=(srow,1), width=50)
    button = Button(frame, text='View Results HTML', bd=1, sticky='ew',
                    command=self.viewHtmlResults, grid=(srow, 2))

    srow +=1
    texts    = ['Submit Project!', 'Check Run Status',
                'Purge Server Result', 'Download Results']
    commands = [self.runCingServer, self.checkStatus,
                self.purgeCingServer, self.downloadResults]

    self.buttonBar = ButtonList(frame, texts=texts, commands=commands,
                                grid=(srow, 0), gridSpan=(1,3))

    for button in self.buttonBar.buttons[:1]:
      button.config(bg=CING_BLUE)

    # # # # # # Residue frame # # # # # #

    frame = LabelFrame(tab, text='Residue Options', grid=(1,0))
    frame.expandGrid(1,1)

    label = Label(frame, text='Chain: ')
    label.grid(row=0,column=0,sticky='w')
    self.chainPulldown = PulldownList(frame, callback=self.changeChain)
    self.chainPulldown.grid(row=0,column=1,sticky='w')

    headingList = ['#','Residue','Linking','Decriptor','Use?']
    editWidgets      = [None,None,None,None,None]
    editGetCallbacks = [None,None,None,None,self.toggleResidue]
    editSetCallbacks = [None,None,None,None,None,]
    self.residueMatrix = ScrolledMatrix(frame,
                                        headingList=headingList,
                                        multiSelect=True,
                                        editWidgets=editWidgets,
                                        editGetCallbacks=editGetCallbacks,
                                        editSetCallbacks=editSetCallbacks,
                                        callback=self.selectResidue)
    self.residueMatrix.grid(row=1, column=0, columnspan=2, sticky = 'nsew')

    texts = ['Activate Selected','Inactivate Selected']
    commands = [self.activateResidues, self.deactivateResidues]
    self.resButtons = ButtonList(frame, texts=texts, commands=commands,)
    self.resButtons.grid(row=2, column=0, columnspan=2, sticky='ew')

    """
    # # # # # # Validate frame # # # # # #

    frame = LabelFrame(tab, text='Validation Options', grid=(2,0))
    frame.expandGrid(None,2)

    srow = 0
    self.selectCheckAssign = CheckButton(frame)
    self.selectCheckAssign.grid(row=srow, column=0,sticky='nw' )
    self.selectCheckAssign.set(True)
    label = Label(frame, text='Assignments and shifts')
    label.grid(row=srow,column=1,sticky='nw')

    srow += 1
    self.selectCheckResraint = CheckButton(frame)
    self.selectCheckResraint.grid(row=srow, column=0,sticky='nw' )
    self.selectCheckResraint.set(True)
    label = Label(frame, text='Restraints')
    label.grid(row=srow,column=1,sticky='nw')

    srow += 1
    self.selectCheckQueen = CheckButton(frame)
    self.selectCheckQueen.grid(row=srow, column=0,sticky='nw' )
    self.selectCheckQueen.set(False)
    label = Label(frame, text='QUEEN')
    label.grid(row=srow,column=1,sticky='nw')

    srow += 1
    self.selectCheckScript = CheckButton(frame)
    self.selectCheckScript.grid(row=srow, column=0,sticky='nw' )
    self.selectCheckScript.set(False)
    label = Label(frame, text='User Python script\n(overriding option)')
    label.grid(row=srow,column=1,sticky='nw')

    self.validScriptEntry = Entry(frame, bd=1, text='')
    self.validScriptEntry.grid(row=srow,column=2,sticky='ew')

    scriptButton = Button(frame, bd=1,
                          command=self.chooseValidScript,
                          text='Browse')
    scriptButton.grid(row=srow,column=3,sticky='ew')
    """

    # # # # # # # # # #

    self.update(simStore)

    self.administerNotifiers(application.registerNotify)