Beispiel #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
Beispiel #2
0
    def setHelpArray(self):
        try:
            myFile = JESResources.getFileFor("help/JESHelp")

            arrayOfFiles = myFile.listFiles()
            arrayOfNames = []

            for x in arrayOfFiles:
                arrayOfNames.append(x.toURL())
            stringNames = []
            for x in arrayOfNames:
                stringNames.append(x.toString())

            # for name in stringNames:
            # if (name.find('.DS_Store') != -1):
            #     if(name.startswith('.')):
            #         stringNames.remove(name)

            stringNames = [
                name for name in stringNames if not helpfile_strip(name).startswith(".")]
            stringNames.sort(helpfile_cmp)

            # l = stringNames[1]
            # stringNames.remove(l)
            # stringNames.insert(10, l)
            self.gui.SetHelpFiles(stringNames)
        except Exception, e:
            print "ERROR opening help files"
            print e
Beispiel #3
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
Beispiel #4
0
    def setHelpArray(self):
        try:
            myFile = JESResources.getFileFor("help/JESHelp")

            arrayOfFiles = myFile.listFiles()
            arrayOfNames = []

            for x in arrayOfFiles:
                arrayOfNames.append(x.toURL())
            stringNames = []
            for x in arrayOfNames:
                stringNames.append(x.toString())

            # for name in stringNames:
            # if (name.find('.DS_Store') != -1):
            #     if(name.startswith('.')):
            #         stringNames.remove(name)

            stringNames = [
                name for name in stringNames
                if not helpfile_strip(name).startswith(".")
            ]
            stringNames.sort(helpfile_cmp)

            # l = stringNames[1]
            # stringNames.remove(l)
            # stringNames.insert(10, l)
            self.gui.SetHelpFiles(stringNames)
        except Exception, e:
            print "ERROR opening help files"
            print e
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
0
 def makeDebuggerButton(self, action, icon):
     imageIcon = JESResources.makeIcon(icon)
     return JButton(action, text=None, icon=imageIcon, margin=self.buttonInsets)
Beispiel #8
0
 def initializeInterpreter(self, terp):
     startup = JESResources.getPathTo('python/jes/user-startup.py')
     terp.runFile(startup, False)
Beispiel #9
0
 def makeDebuggerButton(self, action, icon):
     imageIcon = JESResources.makeIcon(icon)
     return JButton(action,
                    text=None,
                    icon=imageIcon,
                    margin=self.buttonInsets)
Beispiel #10
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()
Beispiel #11
0
 def initializeInterpreter(self, terp):
     preproc = JESResources.getPathTo('python/JESPreprocessing.py')
     terp.runFile(preproc, False)
Beispiel #12
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()