Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
 def initializeInterpreter(self, terp):
     startup = JESResources.getPathTo('python/jes/user-startup.py')
     terp.runFile(startup, False)
Esempio n. 6
0
 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()
Esempio n. 7
0
 def initializeInterpreter(self, terp):
     preproc = JESResources.getPathTo('python/JESPreprocessing.py')
     terp.runFile(preproc, False)
Esempio n. 8
0
 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()