Ejemplo n.º 1
0
 def handleNotification(self, note):
     try:
         noteName = note.getName()
         if noteName == Notification.SHOW_DIALOG:
             alert(note.getBody())
     except:
         raise
Ejemplo n.º 2
0
 def handleNotification(self, note):
     try:
         noteName = note.getName()
         if noteName == Notification.SHOW_DIALOG:
             alert(note.getBody())
     except:
         raise
Ejemplo n.º 3
0
 def handleNotification(self, note):
     try:
         noteName = note.getName()
         if noteName == EmployeeAdmin.AppFacade.SHOW_DIALOG:
             alert(note.getBody())
     except:
         raise
Ejemplo n.º 4
0
    def test(self,elm,event,msg='foi'):
        location = None
        JS('''
           location = window.location.hostname;

           ''')
        if 'localhost' == location: location +=':8004'
        return location
        x = DOM.eventGetClientX(event)
        y = DOM.eventGetClientY(event)
        alert ('%s %s %s'%(msg,x,y))
Ejemplo n.º 5
0
 def onClickOpen(self, sender):
     global has_getAsText
     data = None
     filename = None
     if self.files:
         if self.files.length == 0:
             return
         if self.files.length > 1:
             alert("Cannot open more than one file")
             return
         file = self.files.item(0)
         filename = file.fileName
         try:
             data = file.getAsText("")
         except AttributeError, e:
             has_getAsText = False
             alert("Sorry. cannot retrieve file in this browser.\nTry again.")
Ejemplo n.º 6
0
 def handleNotification(self, note):
     try:
         noteName = note.getName()
         nodeBody = note.getBody()
         if noteName == Notification.CELL_SELECTED:
             alert("Select cell is not implemented yet")
         elif noteName == Notification.CELL_UPDATED:
             alert("Cell changed is not implemented yet")
         elif noteName == Notification.DATE_SELECTED:
             self.onDateSelected(nodeBody)
         elif noteName == Notification.EDIT_SELECTED:
             self.onEditSelected()
         elif noteName == Notification.SUM_SELECTED:
             self.onSumSelected()
         elif noteName == Notification.FILE_LOADED:
             self.onFileLoaded(*nodeBody)
     except:
         raise
Ejemplo n.º 7
0
 def onClickOpen(self, sender):
     global has_getAsText
     data = None
     filename = None
     if self.files:
         if self.files.length == 0:
             return
         if self.files.length > 1:
             alert("Cannot open more than one file")
             return
         file = self.files.item(0)
         filename = file.fileName
         try:
             data = file.getAsText("")
         except AttributeError, e:
             has_getAsText = False
             alert(
                 "Sorry. cannot retrieve file in this browser.\nTry again.")
Ejemplo n.º 8
0
    def __init__(self):

        self.tb = TextBox()
        self.b = Button("add")
        self.g = Grid()
        self.g.resize(4, 2)

        RootPanel().add(HTML("Add Phrase.  Press Button."))
        RootPanel().add(self.tb)
        RootPanel().add(self.b)
        RootPanel().add(self.g)
        self.b.addClickListener(self)

        try:
            self.db = Factory.createDatabase()
            self.db.open('database-demo')
            self.db.execute('create table if not exists Demo' +
                       ' (Phrase varchar(255), Timestamp int)')
        except:
            alert("Could not create database.\nDo you have the google gears extension installed?")
Ejemplo n.º 9
0
    def __init__(self):

        self.tb = TextBox()
        self.b = Button("add")
        self.g = Grid()
        self.g.resize(4, 2)

        RootPanel().add(HTML("Add Phrase.  Press Button."))
        RootPanel().add(self.tb)
        RootPanel().add(self.b)
        RootPanel().add(self.g)
        self.b.addClickListener(self)

        try:
            self.db = Factory.createDatabase()
            self.db.open('database-demo')
            self.db.execute('create table if not exists Demo' +
                            ' (Phrase varchar(255), Timestamp int)')
        except:
            alert(
                "Could not create database.\nDo you have the google gears extension installed?"
            )
Ejemplo n.º 10
0
 def onClick(self, sender):
     global has_getAsText
     if sender == self.cancelBtn:
         self.hide()
     elif sender == self.openBtn:
         data = None
         filename = None
         if self.files:
             if self.files.length == 0:
                 return
             if self.files.length > 1:
                 alert("Cannot open more than one file")
                 return
             file = self.files.item(0)
             filename = file.fileName
             try:
                 data = file.getAsText("")
             except AttributeError, e:
                 has_getAsText = False
                 alert("Sorry. cannot retrieve file in this browser.\nTry again.")
         else:
             elem = self.iframe.getElement()
             # On firefox, this runs into:
             #   Permission denied to get property Window.document
             # when the file is not in the current domain
             body = elem.contentWindow.document.body
             try:
                 filename = "" + elem.contentWindow.location
             except:
                 filename = None
             if body.childNodes.length == 1:
                 data = "" + body.childNodes.item(0).innerHTML
             else:
                 data = "" + body.innerHTML
         self.hide()
         if data:
             self.mediator.sendNotification(Notification.FILE_LOADED, (filename, data))
Ejemplo n.º 11
0
import pyjd

try:
    from puremvc.patterns.facade import Facade
except:
    from pyjamas.Window import alert
    alert("""\
This application depends on puremvc for python,\n\
which doesn't seem to be available.\n\
See README.
""")

from pyjamas.Timer import Timer

from ApplicationConstants import Notification
from controller.StartupCommand import StartupCommand
from view.components.AppFrame import AppFrame

class AppFacade(Facade):

    def __init__(self):
        self.initializeFacade()
        self.initializeController()
        self.registerCommand(Notification.STARTUP, StartupCommand)

    @staticmethod
    def getInstance():
        return AppFacade()

# workaround for pyjd xulrunner issue: timesheet uses XMLHttpRequest.
class TimerCls:
Ejemplo n.º 12
0
 def invalid(lineno, line):
     alert("Invalid line at %s:\n%s" % (lineno, line))
     return False
Ejemplo n.º 13
0
 def talk(self,msg='foi'):
     alert (msg)
Ejemplo n.º 14
0
import pyjd

try:
    from puremvc.patterns.facade import Facade
except:
    from pyjamas.Window import alert
    alert("""\
This application depends on puremvc for python,\n\
which doesn't seem to be available.\n\
See README.
""")

from pyjamas.Timer import Timer

from ApplicationConstants import Notification
from controller.StartupCommand import StartupCommand
from view.components.AppFrame import AppFrame


class AppFacade(Facade):
    def __init__(self):
        self.initializeFacade()
        self.initializeController()
        self.registerCommand(Notification.STARTUP, StartupCommand)

    @staticmethod
    def getInstance():
        return AppFacade()


# workaround for pyjd xulrunner issue: timesheet uses XMLHttpRequest.
Ejemplo n.º 15
0
	def __init__(self):
		SimplePanel.__init__(self)
		f=open("texto.txt","r")
		script=f.read()
		f.close()
		alert(script)