예제 #1
0
    def __init__(self, **kwargs):
        self.backyear = kwargs.pop('BackyearSymbol', '<<')
        self.backmonth = kwargs.pop('BackmonthSymbol', '<')
        self.fwdyear = kwargs.pop('FwdyearSymbol', '>>')
        self.fwdmonth = kwargs.pop('FwdmonthSymbol', '>')
        self.addbuttons = kwargs.pop('AddButtons', True)
        self.mindate = kwargs.pop('MinDate', None) # (yr, mnth, day)
        self.maxdate = kwargs.pop('MaxDate', None) # (yr, mnth, day)
        self.weekdaylength = kwargs.pop('WeekdayLength', 1) 
        self.dayoffset = kwargs.pop('DayOffset', 1) # 1 returns Mon, 0 for Sun
        self.daybuttons = kwargs.pop('DayButtons', False)
        if kwargs.pop('ArrowButtons', False):
            self.bkls = Button
        else:
            self.bkls = Hyperlink

        FocusPanel.__init__(self, **kwargs)

        self.setDate()

        self.todayYear = self.currentYear
        self.todayMonth = self.currentMonth
        self.todayDay = self.currentDay
        self.selectedDateListeners = []
        self.defaultGrid = None # used later
예제 #2
0
 def __init__(self):
     FocusPanel.__init__(self)
     self.theChild = ChildGChart()
     self.theChild.update()
     self.setWidget(self.theChild)
     self.addKeyboardListener(self)
     self.addMouseListener(self)
예제 #3
0
    def __init__(self, **kwargs):
        """ setMatchPattern - defaults to '' to match everything
            match pattern examples: '^[0-9]*$' is for digits only
                                    '^[0-9,A-Z]*$' is for digits and uppercase
            setMaxLength
            setText
OB        """

        kwargs['MatchPattern'] = kwargs.pop('MatchPattern', '')
        cs = kwargs.pop('CursorStyle', "inputbox-cursor")
        gs = kwargs.pop('StyleName', 'gwt-inputbox')

        ap = AbsolutePanel(StyleName="inputbox")
        self.tp = Grid(StyleName=gs, Width="100%", Height="100%",
                       CellPadding=0, CellSpacing=0)
        self.cursor = HTML(StyleName=cs)
        ap.add(self.tp)
        ap.add(self.cursor, 0, 0)
        self.cf = self.tp.getCellFormatter()

        FocusPanel.__init__(self, Widget=ap, **kwargs)

        self.addTableListener(self)
        self.addKeyboardListener(self)
        self.addFocusListener(self)

        self.word_selected_pos = 0
        self.ctimer = Timer(notify=self.cursorFlash)
        self.focusset = False
        self.cstate = False
        self._keypressListeners = []
예제 #4
0
def main(init):
    root = RootPanel()
    container = FocusPanel()
    DeferredCommand.add(Focus(container))
    root.add(container)
    container.setSize(21*15,21*15)
    init(container)
예제 #5
0
    def onModuleLoad(self):
        h = HTML("<b />Contest: ")
        self.contest.add(h)
        l = HTML("<b />Selection: ")
        self.selection.add(l)
#        self.mainPanel.add(self.button)
        self.mainPanel.add(self.contest)
        self.mainPanel.add(self.selection)
        
        panel = FocusPanel(Widget=self.mainPanel)
        gp = RootPanelListener(panel)
        manageRootPanel(gp)
        RootPanel().add(panel)
        panel.setFocus(True)
예제 #6
0
파일: pjBallot.py 프로젝트: simbara/Voting
 def onModuleLoad(self):
     print "inside onModuleLoad"
     self.remote_py = JSONService()
     self.mainPanel.add(sampleBallot.title)
     self.mainPanel.add(sampleBallot.instructions)
     self.mainPanel.add(sampleBallot.contest)
     self.mainPanel.add(sampleBallot.candidate)
     self.mainPanel.add(sampleBallot.selection)
     self.mainPanel.add(sampleBallot.status)
     panel = FocusPanel(Widget=self.mainPanel)
     gp = RootPanelListener(panel)
     manageRootPanel(gp)
     RootPanel().add(panel)
     panel.setFocus(True)
     self.remote_py.passBallot(self)
예제 #7
0
    def __init__(self, **kwargs):
        FocusPanel.__init__(self, **kwargs)
        DateSelectedHandler.__init__(self)
        yr, mth, day = time.strftime("%Y-%m-%d").split("-")
        self.todayYear = int(yr)
        self.todayMonth = int(mth)  # change to offset 0 as per javascript
        self.todayDay = int(day)

        self.currentMonth = self.todayMonth
        self.currentYear = self.todayYear
        self.currentDay = self.todayDay


        self.defaultGrid = None # used later

        return
예제 #8
0
파일: Calendar.py 프로젝트: jwashin/pyjs
    def __init__(self, **kwargs):
        FocusPanel.__init__(self, **kwargs)
        yr, mth, day = time.strftime("%Y-%m-%d").split("-")
        self.todayYear = int(yr)
        self.todayMonth = int(mth)  # change to offset 0 as per javascript
        self.todayDay = int(day)

        self.currentMonth = self.todayMonth
        self.currentYear = self.todayYear
        self.currentDay = self.todayDay

        self.selectedDateListeners = []

        self.defaultGrid = None # used later

        return
예제 #9
0
    def onModuleLoad(self):
        self.remote_py = JSONService()
        h = HTML("<b />Contest: ")
        self.contest.add(h)
        l = HTML("<b />Selection: ")
        self.selection.add(l)
#        self.mainPanel.add(self.button)
        self.mainPanel.add(self.contest)
        self.mainPanel.add(self.selection)
        self.mainPanel.add(self.status)
        panel = FocusPanel(Widget=self.mainPanel)
        gp = RootPanelListener(panel)
        manageRootPanel(gp)
        RootPanel().add(panel)
        panel.setFocus(True)
#        self.remote_py.uppercase('yay', self)
        self.remote_py.passBallot(self)
예제 #10
0
    def __init__(self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        FocusPanel.__init__(self, kwargs)

        area1 = TextArea()
        area1.setText("Zakładka 1")

        area2 = TextArea()
        area2.setText("Zakładka 2")

        area3 = TextArea()
        area3.setText("Zakładka 2")

        tabs = TabPanel()
        tabs.add(area2, tabText="Gra nr 1")
        tabs.add(area1, tabText="Pokój gier")
        tabs.add(area3, tabText="Pokój gier")

        self.add(tabs)

        lwindow = LoginWindow(centered=True)
        lwindow.setPopupPosition(100, 100)
        lwindow.show()
예제 #11
0
    def __init__ (self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        FocusPanel.__init__(self, kwargs)

        area1 = TextArea()
        area1.setText("Zakładka 1")

        area2 = TextArea()
        area2.setText("Zakładka 2")

        area3 = TextArea()
        area3.setText("Zakładka 2")

        tabs = TabPanel()
        tabs.add(area2, tabText="Gra nr 1")
        tabs.add(area1, tabText="Pokój gier")
        tabs.add(area3, tabText="Pokój gier")

        self.add (tabs)

        lwindow = LoginWindow(centered=True)
        lwindow.setPopupPosition (100, 100)
        lwindow.show()
예제 #12
0
  def __init__(self):
    Composite.__init__(self)

    vp = VerticalPanel(Spacing=10)
    
    self.canvas = Canvas(800, 600)
    
    handle_run      = RunHandle(self.canvas)
    handle_cg       = ChangeLabelHandle(self.canvas)
    handle_classify = ClassifyHandle(self.canvas)
    handle_clear    = ClearHandle(self.canvas)
    
    self.run      = Button("Run!",         handle_run,      StyleName='button')
    self.change   = Button("Change label", handle_cg,       StyleName='button')
    self.classify = Button("Classify",     handle_classify, StyleName='button')
    self.clear    = Button("Clear",        handle_clear,    StyleName='button')
    
    hp = HorizontalPanel(Spacing=10)
    hp.add(self.run)
    hp.add(self.change)
    hp.add(self.classify)
    hp.add(self.clear)
    
    vp.add(Label("Optimum-Path Forest Classifier Demo", StyleName='label'))
    vp.add(self.canvas)
    vp.add(hp)

    panel = FocusPanel()
    panel.add(self.canvas)
    panel.addKeyboardListener(self.canvas)
    panel.addMouseListener(self.canvas)
    panel.setFocus(True)
    
    vp.add(panel)
    
    self.initWidget(vp)
예제 #13
0
 def _getProps(self):
     return FocusPanel._getProps() + self._props
예제 #14
0

if __name__ == "__main__":
    # Check if run manually
    if "pygame" in sys.argv[1:]:
        USING_PYGAME = True
    if "statmode" in sys.argv[1:]:
        STATMODE = True
        import getopt

        optlist, args = getopt.getopt(sys.argv[1:], "n:")
        for o, a in optlist:
            if o == "-n":
                STATMODE_ROUNDS = int(a)

    if not USING_PYGAME and not STATMODE:
        import pyjd
        from main_widget import MainWidget
        from pyjamas.ui.FocusPanel import FocusPanel
        from pyjamas.ui.RootPanel import RootPanel

        pyjd.setup("output/main.html")
        main_widget = MainWidget(SW, SH)
        panel = FocusPanel(Widget=main_widget.context)
        panel.addMouseListener(main_widget.context)
        setattr(main_widget.context, "onMouseUp", lambda sender, x, y: handle_click(x, y))
        RootPanel().add(panel)
        RootPanel().add(main_widget)
        pyjd.run()
    main()
예제 #15
0
파일: Space.py 프로젝트: minghuascode/pyj
    def __init__(self, Parent, *args, **kwargs):
        self.Parent = Parent
        self.focussed = False
        RootPanelCls.__init__(self, *args, **kwargs)
        ClickHandler.__init__(self)
        KeyboardHandler.__init__(self)

        self.addClickListener(self)

    def onClick(self, Sender):
        self.focussed = not self.focussed
        self.Parent.setFocus(self.focussed)

if __name__ == '__main__':
    pyjd.setup("public/Space.html")
    c = GameCanvas(800, 600)
    panel = FocusPanel(Widget=c)
    RootPanel().add(panel)
    panel.addKeyboardListener(c)
    panel.setFocus(True)
    RootPanel().add(HTML("""
<hr/>
Left/Right arrows turn, Up key thrusts, Space bar fires<br/>
<a href="http://rumsey.org/blog/?p=215">About Space Game</a> by <a href="http://rumsey.org/blog/">Ogre</a><br/>
Written entirely in Python, using <a href="http://pyj.be/">Pyjamas</a></br>
Copyright &copy; 2009 Joe Rumsey
"""))

    #c.getElement().focus()
    pyjd.run()
예제 #16
0

if __name__ == '__main__':

    pyjd.setup("public/ClickableRootPanel.html")

    bh = Button("Click me to set body height to 100%",
                heightset,
                StyleName='teststyle')
    b = Button("Click me to set body margin to 0",
               marginset,
               StyleName='teststyle')
    h = HTML("<b>Hello World</b> - watch for focus highlighting after click",
             StyleName='teststyle')

    panel = FocusPanel(Widget=h)
    gp = RootPanelListener(panel, StyleName='rootstyle')

    # as this is replacing the 'normal' usage of RootPanel(),
    # it is necessary to add this in 'by hand' so that the
    # window-close notification is 'hooked into', and so when
    # the browser window is closed, cleanups (onDetach) will
    # be triggered.
    #
    # calling manageRootPanel (with the default arg id=None)
    # also has the advantage that RootPanel(id=None) will
    # 'pick up' the above RootPanelListener instance, meaning
    # that you don't need to have a silly global variable
    # all over the place, you can just use the standard pyjamas
    # API as normal.
    #
예제 #17
0
파일: Space.py 프로젝트: minghuascode/pyj
        self.focussed = False
        RootPanelCls.__init__(self, *args, **kwargs)
        ClickHandler.__init__(self)
        KeyboardHandler.__init__(self)

        self.addClickListener(self)

    def onClick(self, Sender):
        self.focussed = not self.focussed
        self.Parent.setFocus(self.focussed)


if __name__ == '__main__':
    pyjd.setup("public/Space.html")
    c = GameCanvas(800, 600)
    panel = FocusPanel(Widget=c)
    RootPanel().add(panel)
    panel.addKeyboardListener(c)
    panel.setFocus(True)
    RootPanel().add(
        HTML("""
<hr/>
Left/Right arrows turn, Up key thrusts, Space bar fires<br/>
<a href="http://rumsey.org/blog/?p=215">About Space Game</a> by <a href="http://rumsey.org/blog/">Ogre</a><br/>
Written entirely in Python, using <a href="http://pyj.be/">Pyjamas</a></br>
Copyright &copy; 2009 Joe Rumsey
"""))

    #c.getElement().focus()
    pyjd.run()