class AboutDialog(BasicDialog): INFO_FILES = ( ("Authors/License", JESResources.getPathTo("help/JESCopyright.txt")), ("Version History", JESResources.getPathTo("help/JESChangelog.txt")), ("Included Software", JESResources.getPathTo("help/JESDependencies.txt")), ) WINDOW_TITLE = "About " + JESVersion.TITLE WINDOW_SIZE = (600, 600) def __init__(self): super(AboutDialog, self).__init__() # Open the files and build a tab pane self.tabbedPane = tabs = JTabbedPane() for title, path in self.INFO_FILES: textPane = JTextPane() textPane.editable = False scrollPane = JScrollPane(textPane) scrollPane.preferredSize = (32767, 32767) # just a large number with open(path, 'r') as fd: infoText = fd.read().decode('utf8') textPane.text = infoText textPane.caretPosition = 0 tabs.addTab(title, scrollPane) # Load this tabbed pane into the layout self.add(tabs, BorderLayout.CENTER) # Add a label at the top versionLabel = JLabel(JESVersion.TITLE + " version " + JESVersion.RELEASE) versionLabel.alignmentX = Component.CENTER_ALIGNMENT versionPanel = JPanel() versionPanel.add(versionLabel) self.add(versionPanel, BorderLayout.PAGE_START) # Make an OK button self.okButton = JButton(self.ok) self.buttonPanel.add(self.okButton) @methodAction(name="OK") def ok(self): self.visible = False
class IntroDialog(BasicDialog): INFO_FILE = JESResources.getPathTo("help/JESIntroduction.txt") WINDOW_TITLE = "Welcome to %s!" % JESVersion.TITLE WINDOW_SIZE = (400, 300) def __init__(self): super(IntroDialog, self).__init__() # Open the text file and make a text pane textPane = JTextPane() textPane.editable = False scrollPane = JScrollPane(textPane) scrollPane.preferredSize = (32767, 32767) # just a large number with open(self.INFO_FILE, 'r') as fd: infoText = fd.read().decode('utf8').replace( "@version@", JESVersion.VERSION ) textPane.text = infoText # Load the scroll pane into the layout self.add(scrollPane, BorderLayout.CENTER) # Make an OK button self.okButton = JButton(self.ok) self.buttonPanel.add(self.okButton) @methodAction(name="OK") def ok(self): self.visible = False
def __init__(self): self.size = ABOUT_WINDOW_SIZE self.title = ABOUT_TITLE self.setLocationRelativeTo(None) self.contentPane.setLayout(swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS)) introductionInfoArea = swing.JTextPane() introductionInfoArea.setEditable(0) # Load information from the JES introduction file introductionFile = open( JESResources.getPathTo('help/JESIntroduction.txt'), 'r') introductionText = introductionFile.read().replace("@version@", JESVersion.VERSION) introductionFile.close() introductionInfoArea.text = introductionText okButton = swing.JButton(OK_BUTTON_CAPTION, actionListener=self) topPane = swing.JScrollPane(introductionInfoArea) topPane.setPreferredSize(awt.Dimension(lang.Short.MAX_VALUE, lang.Short.MAX_VALUE)) bottomPanel = swing.JPanel() bottomPanel.add(okButton) self.contentPane.add(topPane) self.contentPane.add(bottomPanel)
def __init__(self): self.size = ABOUT_WINDOW_SIZE self.title = ABOUT_TITLE self.setLocationRelativeTo(None) self.contentPane.setLayout(swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS)) copyrightInfoArea = swing.JTextPane() copyrightInfoArea.setEditable(0) # Load copyright information from the JES copyright file copyrightFile = open( JESResources.getPathTo('help/JESCopyright.txt'), 'r') copyrightInfoArea.text = copyrightFile.read().decode("utf8") copyrightInfoArea.setCaretPosition(0) copyrightFile.close() okButton = swing.JButton(OK_BUTTON_CAPTION, actionListener=self) topPane = swing.JScrollPane(copyrightInfoArea) topPane.setPreferredSize(awt.Dimension(lang.Short.MAX_VALUE, lang.Short.MAX_VALUE)) bottomPanel = swing.JPanel() bottomPanel.add(okButton) self.contentPane.add(topPane) self.contentPane.add(bottomPanel)
def initializeInterpreter(self, terp): startup = JESResources.getPathTo('python/jes/user-startup.py') terp.runFile(startup, False)
def initializeInterpreter(self, terp): startup = JESResources.getPathTo('python/jes/user-startup.py') #terp.runFile(startup, False) #Henry Rachootin did this. This way, everything will be loaded before we start using it. startupThread = terp.runFile(startup, False) startupThread.join()
def initializeInterpreter(self, terp): preproc = JESResources.getPathTo('python/JESPreprocessing.py') terp.runFile(preproc, False)