Ejemplo n.º 1
0
 def mouseClicked(self, event):
     if event.source == self.jDocs:
         uri = URI.create("https://github.com/DanNegrea/PyRules")
         if uri and Desktop.isDesktopSupported() and Desktop.getDesktop(
         ).isSupported(Desktop.Action.BROWSE):
             Desktop.getDesktop().browse(uri)
     return
Ejemplo n.º 2
0
 def _open_website(self, url):
     uri = URI(url)
     desktop = None
     if Desktop.isDesktopSupported():
         desktop = Desktop.getDesktop()
     if desktop and desktop.isSupported(Desktop.Action.BROWSE):
         desktop.browse(uri)
Ejemplo n.º 3
0
def move_script_warning():
    """Warn the user to move qat_script directory into Scripting Plugin
       directory
    """
    scriptingPluginDir = PluginHandler.getPlugin("scripting").getPluginDir()
    pane = JPanel(GridLayout(3, 1, 5, 5))
    warningTitle = "Warning: qat_script directory not found"
    pane.add(JLabel("Please, move qat_script directory to the following location and start the script again:\n"))
    defaultPathTextField = JTextField(scriptingPluginDir,
                                      editable=0,
                                      border=None,
                                      background=None)
    pane.add(defaultPathTextField)

    if not Desktop.isDesktopSupported():
        JOptionPane.showMessageDialog(
            Main.parent,
            pane,
            warningTitle,
            JOptionPane.WARNING_MESSAGE)
    else:
        #add a button to open default path with the files manager
        pane.add(JLabel("Do you want to open this folder?"))
        options = ["No", "Yes"]
        answer = JOptionPane.showOptionDialog(
            Main.parent,
            pane,
            warningTitle,
            JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            None,
            options,
            options[1])
        if answer == 1:
            Desktop.getDesktop().open(File(scriptingPluginDir))
Ejemplo n.º 4
0
def move_script_warning():
    """Warn the user to move qat_script directory into Scripting Plugin
       directory
    """
    scriptingPluginDir = PluginHandler.getPlugin("scripting").getPluginDir()
    pane = JPanel(GridLayout(3, 1, 5, 5))
    warningTitle = "Warning: qat_script directory not found"
    pane.add(
        JLabel(
            "Please, move qat_script directory to the following location and start the script again:\n"
        ))
    defaultPathTextField = JTextField(scriptingPluginDir,
                                      editable=0,
                                      border=None,
                                      background=None)
    pane.add(defaultPathTextField)

    if not Desktop.isDesktopSupported():
        JOptionPane.showMessageDialog(Main.parent, pane, warningTitle,
                                      JOptionPane.WARNING_MESSAGE)
    else:
        #add a button to open default path with the files manager
        pane.add(JLabel("Do you want to open this folder?"))
        options = ["No", "Yes"]
        answer = JOptionPane.showOptionDialog(Main.parent, pane, warningTitle,
                                              JOptionPane.YES_NO_OPTION,
                                              JOptionPane.QUESTION_MESSAGE,
                                              None, options, options[1])
        if answer == 1:
            Desktop.getDesktop().open(File(scriptingPluginDir))
Ejemplo n.º 5
0
 def __init__(self):
     if formData.get("func") == "open-file":
         file = formData.get("file")
         print " * open.py: Opening file %s..." % file
         Desktop.getDesktop().open(File(file))
     writer = response.getPrintWriter("text/plain")
     writer.println("{}")
     writer.close()
Ejemplo n.º 6
0
 def open(self, url, new=0, autoraise=1):
     if not Desktop.isDesktopSupported():
         raise Error("webbrowswer.py not supported in your environment")
     try:
         Desktop.getDesktop().browse(URI(url))
         return True
     except IOError as e:
         raise Error(e)
Ejemplo n.º 7
0
 def open(self, url, new=0, autoraise=1):    
     if not Desktop.isDesktopSupported():
         raise Error("webbrowswer.py not supported in your environment")
     try:
         Desktop.getDesktop().browse(URI(url))
         return True
     except IOError as e:
         raise Error(e)
Ejemplo n.º 8
0
    def onAboutClick(self, event):
        """Open the about webpage of this extension.

        Args:
            event (obj): The Java on click event.

        """

        Desktop.getDesktop().browse(URI("https://github.com/tijme/graphwave"))
Ejemplo n.º 9
0
    def actionPerformed(self, event):
        import java.awt.Desktop as Desktop
	import java.net.URI as URI

        cmd = event.getActionCommand()

        if cmd == COMMAND_SEND:
            Desktop.getDesktop().browse(URI("http://code.google.com/p/mediacomp-jes/issues/list"))

        self.setVisible(0)
        self.dispose()
Ejemplo n.º 10
0
    def _button_web_browser_pressed(self, msg):
        url = "http://pages.bao7uo.com"

        field = self._get_btn_field_value(msg)

        if field[0] == "phantomJS_args":
            url = PhantomJS.uri
        elif field[0] == "url":
            url = field[1]

        Desktop.getDesktop().browse(URI(url))
Ejemplo n.º 11
0
    def actionPerformed(self, event):
        import java.awt.Desktop as Desktop
        import java.net.URI as URI

        cmd = event.getActionCommand()

        if cmd == COMMAND_SEND:
            Desktop.getDesktop().browse(
                URI("http://code.google.com/p/mediacomp-jes/issues/list"))

        self.setVisible(0)
        self.dispose()
Ejemplo n.º 12
0
 def __init__(self):
     writer = response.getPrintWriter("text/plain; charset=UTF-8")
     jsonResponse = "{}"
     try:
         oid = formData.get("oid")
         object = Services.getStorage().getObject(oid);
         filePath = object.getMetadata().getProperty("file.path")
         object.close()
         print "Opening file '%s'..." % filePath
         Desktop.getDesktop().open(File(filePath))
     except Exception, e:
         jsonResponse = '{ "message": "%s" }' % e.getMessage()
Ejemplo n.º 13
0
 def __activate__(self, context):
     self.vc = context
     writer = self.vc["response"].getPrintWriter(
         "text/plain; charset=UTF-8")
     jsonResponse = "{}"
     try:
         oid = self.vc["formData"].get("oid")
         object = Services.getStorage().getObject(oid)
         filePath = object.getMetadata().getProperty("file.path")
         object.close()
         print "Opening file '%s'..." % filePath
         Desktop.getDesktop().open(File(filePath))
     except Exception, e:
         jsonResponse = '{ "message": "%s" }' % e.getMessage()
Ejemplo n.º 14
0
 def __init__(self, program):
     url = "https://yeswehack.com/programs/{}".format(program.slug)
     btn = JButton("Open in browser")
     btn.addActionListener(
         CallbackActionListener(lambda _: Desktop.getDesktop().browse(URI(url)))
     )
     self.add(btn)
Ejemplo n.º 15
0
def mess():
    print "unicode() - nie chce dzialc/n" +"unicode() - don't work :("
    part01 = "Too old java version pleas upgrade to  7u11 or higher.\n"
    message =  part01 + "Zbyt stara wersja Java prosze zaktualizowac do 7u11 lub wyzszej."
    jop.showMessageDialog(None, message)

    try:
        if platform.dist() == ('debian', 'wheezy/sid'):#for ubuntu
            getjava = "http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html"

        else:
            getjava = "http://www.java.com"

        desk.getDesktop().browse(url(getjava).toURI())

    except:
        pass

    sys.exit()
Ejemplo n.º 16
0
    def __init__(self, text="Open In Browser"):
        self.menuitem = JMenuItem(text)
        self.menuitem.setEnabled(False)
        self.menuitem.addActionListener(self)

        self.openers = [
            lambda url: Desktop.getDesktop().browse(URI(url)),
            lambda url: subprocess.call(["xdg-open", url]),
            lambda url: subprocess.call(["open", url])
        ]
Ejemplo n.º 17
0
    def Launch_Application(self, path):

        Desktop.getDesktop().open(File(path))
Ejemplo n.º 18
0
 def openURL(self,event):
     try:
         Desktop.getDesktop().browse(net.URI(self.url))
     except:
         Runtime.getRuntime().exec("xdg-open "+self.url)
Ejemplo n.º 19
0
 def openURL(self, event):
     if platform.system() == 'Windows' or platform.system() == 'Darwin':
         Desktop.getDesktop().browse(net.URI(self.url))
     else:
         Runtime.getRuntime().exec("xdg-open " + self.url)
Ejemplo n.º 20
0
 def __openFile(self):
     value = formData.get("value")
     print " * detail.py: opening file %s..." % value
     Desktop.getDesktop().open(File(value))
Ejemplo n.º 21
0
 def hyperlinkUpdate(self, hle):
     if hle.EventType.ACTIVATED == hle.getEventType():
         desktop = Desktop.getDesktop()
         desktop.browse(hle.getURL().toURI())
Ejemplo n.º 22
0
 def __openFile(self):
     file = formData.get("file")
     print " * detail.py: opening file %s..." % file
     Desktop.getDesktop().open(File(file))
Ejemplo n.º 23
0
def startFile(filename):
    from java.awt import Desktop
    from java.io import File
    d = Desktop.getDesktop()
    d.open(File(filename))
    return True
Ejemplo n.º 24
0
 def mouseClicked(self, msg):
     Desktop.getDesktop().browse(URI("https://translate.google.com"))
Ejemplo n.º 25
0
 def send(self):
     Desktop.getDesktop().browse(WEBSITE_URI)
     self.visible = False
Ejemplo n.º 26
0
    def actionPerformed(self, event):
        #Load button was clicked
        #> opens the file chooser
        #> opens and parses the file
        #> populates the persistand value and script panes
        #> display path inside FileName field
        if self.jLoad == event.getSource():
            if self.jFileName.getText() == Strings.jFileName_default:
                jFileChooser = JFileChooser()
            else:
                jFileChooser = JFileChooser(self.jFileName.getText())
            result = jFileChooser.showOpenDialog(None)

            if result == JFileChooser.APPROVE_OPTION:
                selectedFile = jFileChooser.getSelectedFile()

                #Update the Tab Title if it contains a file name or default name
                currentTitle = self._ui.getTabName(self)
                currentFile = FileSystems.getDefault().getPath(
                    self.jFileName.getText()).getFileName().toString()

                if self.jFileName.getText(
                ) == Strings.jFileName_default or currentTitle == currentFile:
                    self._ui.setTabName(
                        self,
                        selectedFile.toPath().getFileName().toString())

                # read from file
                (vars, script) = FileUtils.read(selectedFile.toPath())

                if vars is None or script is None:
                    # content could not be parsed
                    JOptionPane.showMessageDialog(None,
                                                  Strings.FileUtils_error,
                                                  Strings.FileUtils_error,
                                                  JOptionPane.ERROR_MESSAGE)

                else:
                    # update var and scipt content
                    self.jVarsPane.setText(vars)
                    self.jScriptPane.setText(script)
                    self._executor.init(vars)

                    # update the File Name to the current choosen file
                    self.jFileName.setText(selectedFile.getAbsolutePath())

        #Save button clicked
        #> open the file chooser
        #> creates the file content
        #> writes the file on disk
        if self.jSave == event.getSource():
            if self.jFileName.getText() == Strings.jFileName_default:
                jFileChooser = JFileChooser()
            else:
                jFileChooser = JFileChooser(self.jFileName.getText())
            #self.jFileName.setText(selectedFile.getAbsolutePath())
            result = jFileChooser.showSaveDialog(None)
            if result == JFileChooser.APPROVE_OPTION:
                selectedFile = jFileChooser.getSelectedFile()
                self.jFileName.setText(selectedFile.getAbsolutePath())

                FileUtils.write(selectedFile.toPath(),
                                self.jVarsPane.getText(),
                                self.jScriptPane.getText())

        #Wiki button clicked
        if self.jWiki == event.getSource():
            uri = URI.create("https://github.com/DanNegrea/PyRules")
            if uri and Desktop.isDesktopSupported() and Desktop.getDesktop(
            ).isSupported(Desktop.Action.BROWSE):
                Desktop.getDesktop().browse(uri)

        #Exit button clicked
        if self.jExit == event.getSource():
            result = JOptionPane.showConfirmDialog(
                None, Strings.jExit_confim_question,
                Strings.jExit_confim_title, JOptionPane.YES_NO_OPTION)
            if result == 0:
                self._ui.deleteTab(self)

        #Clear button clicked
        if self.jClear == event.getSource():
            self.jConsoleText.setText("")
            self.log(self._executor.getVars(), "state")

        #Run once button clicked
        if self.jRun == event.getSource():
            if self.isRequestFocusEnabled():
                print "is RequestFocusEnabled"
            else:
                print "is NOT RequestFocusEnabled"
            if self.isFocusOwner():
                print "is FocusOwner"
            else:
                print "is NOT FocusOwner"
            # request to init the vars (if edited)
            self.initVars()
            # request execution with toolFlag set to 999 (Run once)
            self.execute(999)
Ejemplo n.º 27
0
from com.jcraft.jsch import JSch
from java.lang import System
import os
import time
from ij.gui import GenericDialog
from fiji.util.gui import GenericDialogPlus
from ij import IJ

from java.awt import Desktop
from java.net import URI

desktop = Desktop.getDesktop()
uri = URI("https://colab.research.google.com/drive/1PRgFZnd0OtT6p61Ce2y0POEoKPNtTE5N#scrollTo=uU-B_7MwFohd") #test url
desktop.browse(uri)


session = None
channel = None

DIALOG = True

if (DIALOG):
	# ----------------- DIALOG TO FILL GLOBAL PARAMETERS -----

	gui = GenericDialog("Parameters")
	gui.addStringField("NGROK Server address :", "0.tcp.ngrok.io")
	gui.addStringField("PORT :", "")
	gui.showDialog()
	HOST = gui.getNextString()
	PORT = int(gui.getNextString())
Ejemplo n.º 28
0
 def send(self):
     Desktop.getDesktop().browse(WEBSITE_URI)
     self.visible = False
Ejemplo n.º 29
0
 def on_link_click(self, event):
     if event.getEventType() != event.EventType.ACTIVATED:
         return
     url = event.getURL()
     if url:
         Desktop.getDesktop().browse(url.toURI())
Ejemplo n.º 30
0
popup("Hello from Git showcase Jython")

import java.awt.Desktop as DT
import java.net.URI as URI

if not DT.isDesktopSupported():
	exit(1)

dt = DT.getDesktop()
dt.browse(URI("http://sikulix.com"))

Debug.on(3)
r = ALL.wait("sxpower.png", 30)
r.below(100).click("quickstart.png")

popup("Click OK:\n- to close the browser window\n- and terminate")

if RUNTIME.runningMac:
  write("#M.w")
else:
  write("#C.w")
Ejemplo n.º 31
0
 def __init__(self):
     self.openers = [
         lambda url: Desktop.getDesktop().browse(URI(url)),
         lambda url: subprocess.call(["xdg-open", url]),
         lambda url: subprocess.call(["open", url])
     ]
Ejemplo n.º 32
0
def openBrowser(url):
    from java.awt import Desktop
    from java.net import URI
    d = Desktop.getDesktop()
    d.browse(URI(url))
    return True