Esempio n. 1
0
    def viewPalesData(self):
        # NBNB TBD
        valueObj = self.outputMatrix

        if isinstance(valueObj, NmrCalc.ExternalData):
            dataStore = valueObj.dataStore
            if dataStore is not None:
                wb = WebBrowser(self, name='PalesData')
                wb.open(dataStore.fullPath)

        elif isinstance(valueObj, NmrCalc.MeasurementListData):
            mm = valueObj.measurementList
            if mm is not None:
                popup = self.parent.editMeasurementLists()
                popup.tabbedFrame.select(1)
                popup.setMeasurementList(mm)

        elif isinstance(valueObj, NmrCalc.StructureEnsembleData):
            models = valueObj.models
            if len(models) == 1:
                popup = self.parent.editStructures()
                popup.tabbedFrame.select(3)
                popup.changeModel(models[0])
                popup.changeTab(3)

        elif isinstance(valueObj, NmrCalc.ConstraintStoreData):
            constraintLists = valueObj.constraintLists
            if len(constraintLists) == 1:
                popup = self.parent.browseConstraints()
                popup.tabbedFrame.select(2)
                popup.changeRestraintList(constraintLists[0])
Esempio n. 2
0
    def open(self, url):

        if self.project:
            name = getProjectWebBrowser(self.project)
            if name:
                self.name = name

        WebBrowser.open(self, url)
Esempio n. 3
0
  def viewHtmlResults(self):

    resultsUrl = self.resultsUrl
    if not resultsUrl:
      msg = 'No current iCing results URL'
      showWarning('Failure', msg, parent=self)
      return

    webBrowser = WebBrowser(self.application, popup=self.application)
    webBrowser.open(self.resultsUrl)
Esempio n. 4
0
def createDismissHelpButtonList(parent, texts = None, commands = None,
                          direction=Tkinter.HORIZONTAL,
                          dismiss_text = '', help_text = '',
                          help_msg = '', help_url = '',
                          buttonBorderwidth=True, expands=True, 
                          dismiss_cmd = None,
                          webBrowser = None,
                          *args, **kw):
  if (texts is None):
    texts = []

  if (commands is None):
    commands = []

  if (not dismiss_text):
    dismiss_text = ''
 
  if (not help_text):
    help_text = ''

  texts = list(texts) + [dismiss_text, help_text]

  popup = getPopup(parent)

  if not webBrowser:
    webBrowser = WebBrowser(popup.top, popup=popup)

  if (not dismiss_cmd):
    dismiss_cmd = popup.close

  if (help_url):
    help_cmd   = lambda url=help_url: webBrowser.open(url)
  else:
    help_cmd = lambda top=popup.top, message=help_msg: memops.gui.HelpPopup.showHelpText(top, message, popup=popup)

  if (type(commands) is types.DictType):
    commands = commands.copy()
    commands[dismiss_text] = dismiss_cmd
    commands[help_text] = help_cmd
  else:
    commands = list(commands) + [dismiss_cmd, help_cmd]

  button_list = ButtonList(parent, texts=texts, commands=commands, buttonBorderwidth=buttonBorderwidth,
                           expands=expands, direction=direction, *args, **kw)
  
  
  if not dismiss_text:
    button_list.cancelIcon = Tkinter.PhotoImage(file=os.path.join(gfxDir,'cancel.gif'))
    button_list.buttons[-2].config(image=button_list.cancelIcon, activebackground=button_list.cget('bg'))
  
  if not help_text:
    button_list.helpIcon   = Tkinter.PhotoImage(file=os.path.join(gfxDir,'help.gif'))
    button_list.buttons[-1].config(image=button_list.helpIcon, activebackground=button_list.cget('bg'))
    

  return button_list