Esempio n. 1
0
    def onModuleLoad(self):
        self.curInfo=''
        self.curSink=None
        self.description=HTML()
        self.sink_list=SinkList()
        self.panel=DockPanel()
        
        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        vp=VerticalPanel()
        vp.setWidth("100%")
        vp.add(self.description)
        vp.add(self.sinkContainer)

        self.description.setStyleName("ks-Info")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        RootPanel().add(Logger())

        #Show the initial screen.
        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showInfo()
Esempio n. 2
0
class DisplayPanel(Composite):
    def __init__(self, owner):
        Composite.__init__(self)
        self.owner = owner
        self.bar = DockPanel()
        
        self.timer_msg = HTML("      timer: ")
        self.timer = TimeDisplay()
        self.timer_panel = HorizontalPanel()
        self.timer_panel.add(self.timer_msg)
        self.timer_panel.add(self.timer)
        
        self.counter_msg = HTML("      total moves: ")
        self.counter = HTML("0")
        self.counter_panel = HorizontalPanel()
        self.counter_panel.add(self.counter_msg)
        self.counter_panel.add(self.counter)
        
        self.initWidget(self.bar)
        self.bar.add(self.timer_panel, DockPanel.WEST)
        self.bar.add(self.counter_panel, DockPanel.EAST)

        self.setStyleName("Puzzle-DisplayPanel")

    def incrCount(self):
        count = self.counter.getText()
        count = int(count) + 1
        self.counter.setText(count)

    def reset(self):
        self.timer.setDisplay(0, 0, 0)
        self.counter.setText("0")
Esempio n. 3
0
    def __init__(self, left=50, top=50):
        try:
            DialogBox.__init__(self, modal=False)

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("Help Contents")
            self.setWidth('80%')

            msg = HTML(
                """\
<h2>Introduction</h2>

This application can be used to maintain a timesheet.

<p/>
On startup, it tries to open the last opened timesheet.

<p/>
There are two modes: Edit and Summary (see menu). In edit mode the user can enter/modify his timescheet. There's some inteligence built in. The 'From' is filled in automatically when the previous line has a 'To'. The 'To' can be filled in as time span, or as end-time. The 'Project' is mandatory (as the 'From' and 'To' are). The user can walk around with the cursor keys.


<h2>Opening and saving sheets</h2>
The sheet can be loaded and saved from a local file. There might be some issues with Firefox, which might refuse access to the document in an iframe.

<br/>
""", True)
            self.dockPanel.add(msg, DockPanel.CENTER)
            self.closeBtn = Button("Close", self)
            self.dockPanel.add(self.closeBtn, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise
Esempio n. 4
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        self.geocoder = Geocoder()

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        self.address = TextBox()
        self.address.setText("Sydney, NSW")
        self.address.addChangeListener(self.codeAddress)

        topPanel.add(self.address)

        button = Button("Geocode")
        button.addClickListener(self.codeAddress)

        topPanel.add(button)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('600', '400')
        self.add(mapPanel, DockPanel.CENTER)

        options = MapOptions(zoom=8,
                             center=LatLng(-34.397, 150.644),
                             mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)
Esempio n. 5
0
    def __init__(self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        DialogBox.__init__(self, kwargs)
        self.dockPanel = DockPanel()
        self.dockPanel.setSpacing(4)

        self.setText("Logowanie")

        hpanel1 = HorizontalPanel()

        login = TextBox()
        login.setText("Login")
        #hpanel1.add(login)

        passwd = TextBox()
        passwd.setText("Hasło")

        self.dockPanel.add(login, DockPanel.NORTH)
        self.dockPanel.add(passwd, DockPanel.NORTH)

        #hpanel1.add(passwd)

        #self.add(hpanel1)

        self.add(login)
        self.add(passwd)
Esempio n. 6
0
    def __init__(self, owner):
        Composite.__init__(self)
        self.owner = owner
        self.bar = DockPanel()
        self.gotoFirst = Button("&lt;&lt;", self)
        self.gotoNext = Button("&gt;", self)
        self.gotoPrev = Button("&lt;", self)
        self.status = HTML()

        self.initWidget(self.bar)
        self.bar.setStyleName("navbar")
        self.status.setStyleName("status")

        buttons = HorizontalPanel()
        buttons.add(self.gotoFirst)
        buttons.add(self.gotoPrev)
        buttons.add(self.gotoNext)
        self.bar.add(buttons, DockPanel.EAST)
        self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
        self.bar.add(self.status, DockPanel.CENTER)
        self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellHorizontalAlignment(self.status,
                                            HasAlignment.ALIGN_RIGHT)
        self.bar.setCellVerticalAlignment(self.status,
                                          HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellWidth(self.status, "100%")

        self.gotoPrev.setEnabled(False)
        self.gotoFirst.setEnabled(False)
    def onModuleLoad(self):
        self.curInfo = ''
        self.curAlgorithm = None
        self.description = HTML()
        self.Algorithm_list = AlgorithmList()
        self.panel = DockPanel()

        self.loadAlgorithms()
        self.AlgorithmContainer = DockPanel()
        self.AlgorithmContainer.setStyleName("ks-Algorithm")

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.add(self.description)
        vp.add(self.AlgorithmContainer)

        self.description.setStyleName("ks-Info")

        self.panel.add(self.Algorithm_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.Algorithm_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        RootPanel().add(Logger())

        #Show the initial screen.
        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showInfo()
Esempio n. 8
0
    def __init__(self, identifier, title, iframe):
        if modal_popups.has_key(identifier):
            return
        modal_popups[identifier] = self

        DialogBoxModal.__init__(self, identifier)

        self.setText(title)

        self.iframe = iframe
        #closeButton = Button("Close", self)
        #msg = HTML("<center>IFRAME:</center>", True)
        self.iframe.setStyleName("gwt-DialogFrame")

        self.dock = DockPanel()
        self.dock.setSpacing(4)

        #dock.add(closeButton, DockPanel.SOUTH)
        #dock.add(msg, DockPanel.NORTH)
        self.dock.add(self.iframe, DockPanel.CENTER)

        #dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        self.dock.setCellWidth(self.iframe, "100%")
        self.dock.setWidth("100%")
        #self.iframe.setWidth("320px")
        #self.iframe.setHeight("200px")
        self.setWidget(self.dock)
Esempio n. 9
0
    def onModuleLoad(self):
        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.add(self.description)
        vp.add(self.sinkContainer)

        self.description.setStyleName("ks-Info")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showIntro()
Esempio n. 10
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("100%")

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("99%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        authors = [("2008, 2009", "Kenneth Casson Leighton", "*****@*****.**")]
        for years, name, email in authors:
            authors_html = \
            '&copy; %s <a href="mailto:%s">%s</a><br />' %\
            (years, email, name)
        authors_panel = HTML()
        authors_panel.setStyleName("ks-Authors")
        authors_panel.setHTML(authors_html[:-6])

        left_panel = DockPanel(Height="100%")
        left_panel.add(self.sink_list, DockPanel.NORTH)
        left_panel.add(authors_panel, DockPanel.SOUTH)

        self.description.setStyleName("ks-Intro")

        self.panel.add(left_panel, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Esempio n. 11
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        self.geocoder = Geocoder()

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        self.address = TextBox()
        self.address.setText("Sydney, NSW")
        self.address.addChangeListener(self.codeAddress)

        topPanel.add(self.address)

        button = Button("Geocode")
        button.addClickListener(self.codeAddress)

        topPanel.add(button)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('600', '400')
        self.add(mapPanel, DockPanel.CENTER)

        options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644),
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)
Esempio n. 12
0
    def set_styles(self):
        self.dock = DockPanel()
        self.dock.setSpacing(3)

        self.dock.setWidth("300")

        self.image = Image(
            latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        self.dock.add(self.image, DockPanel.EAST)
        self.dock.setCellHorizontalAlignment(self.image,
                                             HasAlignment.ALIGN_TOP)

        self.backspaceButton_add()
        self.doneButton_add()

        self.dock.add(HTML(""), DockPanel.CENTER)
        left = 100
        top = 100

        self.setText("opkop")
        self.setPopupPosition(left, top)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "blue")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")

        self.setWidget(self.dock)
Esempio n. 13
0
    def testDockAdd(self):
        self.d = DockPanel()
        RootPanel('tests').add(self.d)
        self.write_test_output('adddockpanel')

        if not RootPanel('tests').remove(self.d):
            self.fail(
                "DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output('removedockpanel')
Esempio n. 14
0
 def __init__(self):
     self.panel = DockPanel()
     self.userList = UserList(self)
     self.userForm = UserForm(self)
     self.rolePanel = RolePanel(self)
     self.panel.add(self.userList, DockPanel.NORTH)
     self.panel.add(self.userForm, DockPanel.WEST)
     self.panel.add(self.rolePanel, DockPanel.EAST)
     RootPanel().add(self.panel)
     self.Show()
Esempio n. 15
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        places = {
            "chicago, il": "Chicago",

            "st louis, mo": "St Louis",
            "joplin, mo": "Joplin, MO",
            "oklahoma city, ok": "Oklahoma City",
            "amarillo, tx": "Amarillo",
            "gallup, nm": "Gallup, NM",
            "flagstaff, az": "Flagstaff, AZ",

            "winona, az": "Winona",
            "kingman, az": "Kingman",
            "barstow, ca": "Barstow",
            "san bernardino, ca": "San Bernardino",
            "los angeles, ca": "Los Angeles"}

        self.start = ListBox()
        self.end = ListBox()

        for value in places:
            self.start.addItem(places[value], value)
            self.end.addItem(places[value], value)

        self.start.addChangeListener(self.calcRoute)
        self.end.addChangeListener(self.calcRoute)

        topPanel.add(self.start)
        topPanel.add(self.end)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('800', '500')
        self.add(mapPanel, DockPanel.CENTER)

        chigado = LatLng(41.850033, -87.6500523)
        options = MapOptions(zoom=7, center=chigado,
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)

        # initialize the renderer
        self.directionsDisplay = DirectionsRenderer()
        self.directionsDisplay.setMap(self.map)

        self.directionsService = DirectionsService()
Esempio n. 16
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        places = {
            "chicago, il": "Chicago",
            "st louis, mo": "St Louis",
            "joplin, mo": "Joplin, MO",
            "oklahoma city, ok": "Oklahoma City",
            "amarillo, tx": "Amarillo",
            "gallup, nm": "Gallup, NM",
            "flagstaff, az": "Flagstaff, AZ",
            "winona, az": "Winona",
            "kingman, az": "Kingman",
            "barstow, ca": "Barstow",
            "san bernardino, ca": "San Bernardino",
            "los angeles, ca": "Los Angeles"
        }

        self.start = ListBox()
        self.end = ListBox()

        for value in places:
            self.start.addItem(places[value], value)
            self.end.addItem(places[value], value)

        self.start.addChangeListener(self.calcRoute)
        self.end.addChangeListener(self.calcRoute)

        topPanel.add(self.start)
        topPanel.add(self.end)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('800', '500')
        self.add(mapPanel, DockPanel.CENTER)

        chigado = LatLng(41.850033, -87.6500523)
        options = MapOptions(zoom=7,
                             center=chigado,
                             mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)

        # initialize the renderer
        self.directionsDisplay = DirectionsRenderer()
        self.directionsDisplay.setMap(self.map)

        self.directionsService = DirectionsService()
Esempio n. 17
0
    def __init__(self, **kwargs):
        DockPanel.__init__(self, **kwargs)
        self.grid = Grid(StyleName="datagrid")
        self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
        self.header = Grid(Height="50px")
        self.add(self.header, DockPanel.NORTH)
        self.add(self.sp, DockPanel.CENTER)
        cf = self.setCellHeight(self.header, "50px")
        cf = self.setCellHeight(self.sp, "100%")

        self.sortcol = 0
Esempio n. 18
0
    def __init__(self, **kwargs):
        DockPanel.__init__(self, **kwargs)
        self.grid = Grid(StyleName="datagrid")
        self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
        self.header = Grid(Height="50px")
        self.add(self.header, DockPanel.NORTH)
        self.add(self.sp, DockPanel.CENTER)
        cf = self.setCellHeight(self.header, "50px")
        cf = self.setCellHeight(self.sp, "100%")

        self.sortcol = 0
Esempio n. 19
0
 def __init__(self):
     DockPanel.__init__(self)
     self.grids = {}
     self.g = Grid()
     self.g.setCellSpacing("0px")
     self.g.setCellPadding("8px")
     self.title = HTML("&nbsp;")
     self.title.setStyleName("rightpanel-title")
     self.add(self.title, DockPanel.NORTH)
     self.setCellWidth(self.title, "100%")
     self.setCellHorizontalAlignment(self.title,
                                     HasHorizontalAlignment.ALIGN_LEFT)
     self.add(self.g, DockPanel.CENTER)
Esempio n. 20
0
 def __init__(self):
     DockPanel.__init__(self)
     self.grids = {}
     self.g = Grid()
     self.g.setCellSpacing("0px")
     self.g.setCellPadding("8px")
     self.title = HTML("&nbsp;")
     self.title.setStyleName("rightpanel-title")
     self.add(self.title, DockPanel.NORTH)
     self.setCellWidth(self.title, "100%")
     self.setCellHorizontalAlignment(self.title,
                                     HasHorizontalAlignment.ALIGN_LEFT)
     self.add(self.g, DockPanel.CENTER)
Esempio n. 21
0
    def __init__(self, title):
        DockPanel.__init__(self)
        self.grid = FlexTable()
        title = HTML(title)
        self.add(title, DockPanel.NORTH)
        self.setCellHorizontalAlignment(title,
                                        HasHorizontalAlignment.ALIGN_LEFT)
        self.add(self.grid, DockPanel.CENTER)
        self.grid.setBorderWidth("0px")
        self.grid.setCellSpacing("0px")
        self.grid.setCellPadding("4px")

        self.formatCell(0, 0)
        self.grid.setHTML(0, 0, "&nbsp;")
Esempio n. 22
0
    def __init__(self, title):
        DockPanel.__init__(self)
        self.grid = FlexTable()
        title = HTML(title)
        self.add(title, DockPanel.NORTH)
        self.setCellHorizontalAlignment(title,
                                        HasHorizontalAlignment.ALIGN_LEFT)
        self.add(self.grid, DockPanel.CENTER)
        self.grid.setBorderWidth("0px")
        self.grid.setCellSpacing("0px")
        self.grid.setCellPadding("4px")

        self.formatCell(0, 0)
        self.grid.setHTML(0, 0, "&nbsp;")
Esempio n. 23
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("98%")
        self.sp.setHeight("%dpx" % (height - 200))

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Esempio n. 24
0
    def __init__(self, identifier, title, iframe):
        if identifier in modal_popups:
            return
        modal_popups[identifier] = self

        DialogBoxModal.__init__(self, identifier)

        self.setText(title)

        self.iframe = iframe
        #closeButton = Button('Close', self)
        #msg = HTML('<center>IFRAME:</center>', True)
        self.iframe.setStyleName('gwt-DialogFrame')

        self.dock = DockPanel()
        self.dock.setSpacing(4)

        #dock.add(closeButton, DockPanel.SOUTH)
        #dock.add(msg, DockPanel.NORTH)
        self.dock.add(self.iframe, DockPanel.CENTER)

        #dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        self.dock.setCellWidth(self.iframe, '100%')
        self.dock.setWidth('100%')
        #self.iframe.setWidth('320px')
        #self.iframe.setHeight('200px')
        self.setWidget(self.dock)
Esempio n. 25
0
    def __init__(self, owner):
        Composite.__init__(self)
        self.owner = owner
        self.bar = DockPanel()
        self.gotoFirst = Button("&lt;&lt;", self)
        self.gotoNext = Button("&gt;", self)
        self.gotoPrev = Button("&lt;", self)
        self.status = HTML()

        self.initWidget(self.bar)
        self.bar.setStyleName("navbar")
        self.status.setStyleName("status")

        buttons = HorizontalPanel()
        buttons.add(self.gotoFirst)
        buttons.add(self.gotoPrev)
        buttons.add(self.gotoNext)
        self.bar.add(buttons, DockPanel.EAST)
        self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
        self.bar.add(self.status, DockPanel.CENTER)
        self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT)
        self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellWidth(self.status, "100%")

        self.gotoPrev.setEnabled(False)
        self.gotoFirst.setEnabled(False)
Esempio n. 26
0
    def __init__(self, provider, columns, columnStyles, rowCount):
        Composite.__init__(self)

        self.acceptor = RowDataAcceptorImpl(self)
        self.outer = DockPanel()
        self.startRow = 0
        self.grid = Grid()
        self.navbar = NavBar(self)

        self.provider = provider
        self.initWidget(self.outer)
        self.grid.setStyleName("table")
        self.outer.add(self.navbar, DockPanel.NORTH)
        self.outer.add(self.grid, DockPanel.CENTER)
        self.initTable(columns, columnStyles, rowCount)
        self.setStyleName("DynaTable-DynaTableWidget")
Esempio n. 27
0
    def __init__(self, left = 50, top = 50):
        try:
            DialogBox.__init__(self, modal = False)

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("Help Contents")
            self.setWidth('80%')

            msg = HTML("""\
<h2>Introduction</h2>

This application can be used to maintain a timesheet.

<p/>
On startup, it tries to open the last opened timesheet.

<p/>
There are two modes: Edit and Summary (see menu). In edit mode the user can enter/modify his timescheet. There's some inteligence built in. The 'From' is filled in automatically when the previous line has a 'To'. The 'To' can be filled in as time span, or as end-time. The 'Project' is mandatory (as the 'From' and 'To' are). The user can walk around with the cursor keys.


<h2>Opening and saving sheets</h2>
The sheet can be loaded and saved from a local file. There might be some issues with Firefox, which might refuse access to the document in an iframe.

<br/>
""", True)
            self.dockPanel.add(msg, DockPanel.CENTER)
            self.closeBtn = Button("Close", self)
            self.dockPanel.add(self.closeBtn, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise
Esempio n. 28
0
File: Popups.py Progetto: Afey/pyjs
    def __init__(self, identifier, title, iframe):
        if modal_popups.has_key(identifier):
            return
        modal_popups[identifier] = self

        DialogBoxModal.__init__(self, identifier)

        self.setText(title)

        self.iframe = iframe
        #closeButton = Button("Close", self)
        #msg = HTML("<center>IFRAME:</center>", True)
        self.iframe.setStyleName("gwt-DialogFrame")

        self.dock = DockPanel()
        self.dock.setSpacing(4)

        #dock.add(closeButton, DockPanel.SOUTH)
        #dock.add(msg, DockPanel.NORTH)
        self.dock.add(self.iframe, DockPanel.CENTER)

        #dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        self.dock.setCellWidth(self.iframe, "100%")
        self.dock.setWidth("100%")
        #self.iframe.setWidth("320px")
        #self.iframe.setHeight("200px")
        self.setWidget(self.dock)
Esempio n. 29
0
    def __init__ (self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        DialogBox.__init__(self, kwargs)
        self.dockPanel = DockPanel()
        self.dockPanel.setSpacing(4)

        self.setText ("Logowanie")

        hpanel1 = HorizontalPanel()
        
        login = TextBox()
        login.setText("Login")
        #hpanel1.add(login)

        passwd = TextBox()
        passwd.setText("Hasło")

        self.dockPanel.add(login, DockPanel.NORTH)
        self.dockPanel.add(passwd, DockPanel.NORTH)

        #hpanel1.add(passwd)

        #self.add(hpanel1)

        self.add(login)
        self.add(passwd)
Esempio n. 30
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()
        
        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height-110))

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
Esempio n. 31
0
    def onModuleLoad(self):

        GMWevents.init_events()
        GMWevents.events.addLoginListener(self) # want to receive onLogin

        self.TEXT_ERROR = "Server Error"
        self.loginpanel = cLoginPanel() # fires logged out on UI load
        self.afterloginpanel = cMainPanel()

        self.maindisplay = DockPanel(
                          HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                          VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                          BorderWidth=1,
                          Padding=8,
                          Width="100%") 

        RootPanel().add(self.maindisplay)
Esempio n. 32
0
    def testDockAdd(self):
        self.d = DockPanel()
        RootPanel('tests').add(self.d)
        self.write_test_output('adddockpanel')

        if not RootPanel('tests').remove(self.d):
            self.fail("DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output('removedockpanel')
Esempio n. 33
0
class DynaTableWidget(Composite):
    def __init__(self, provider, columns, columnStyles, rowCount):
        Composite.__init__(self)

        self.acceptor = RowDataAcceptorImpl(self)
        self.outer = DockPanel()
        self.startRow = 0
        self.grid = Grid()
        self.navbar = NavBar(self)

        self.provider = provider
        self.initWidget(self.outer)
        self.grid.setStyleName("table")
        self.outer.add(self.navbar, DockPanel.NORTH)
        self.outer.add(self.grid, DockPanel.CENTER)
        self.initTable(columns, columnStyles, rowCount)
        self.setStyleName("DynaTable-DynaTableWidget")

    def initTable(self, columns, columnStyles, rowCount):
        self.grid.resize(rowCount + 1, len(columns))
        for i in range(len(columns)):
            self.grid.setText(0, i, columns[i])
            if columnStyles:
                self.grid.cellFormatter.setStyleName(
                    0, i, columnStyles[i] + "header")

    def setStatusText(self, text):
        self.navbar.status.setText(text)

    def clearStatusText(self, text):
        self.navbar.status.setHTML("&nbsp;")

    def refresh(self):
        self.navbar.gotoFirst.setEnabled(False)
        self.navbar.gotoPrev.setEnabled(False)
        self.navbar.gotoNext.setEnabled(False)

        self.setStatusText("Please wait...")
        self.provider.updateRowData(self.startRow,
                                    self.grid.getRowCount() - 1, self.acceptor)

    def setRowCount(self, rows):
        self.grid.resizeRows(rows)

    def getDataRowCount(self):
        return self.grid.getRowCount() - 1
Esempio n. 34
0
class DynaTableWidget(Composite):

    def __init__(self, provider, columns, columnStyles, rowCount):
        Composite.__init__(self)

        self.acceptor = RowDataAcceptorImpl(self)
        self.outer = DockPanel()
        self.startRow = 0
        self.grid = Grid()
        self.navbar = NavBar(self)

        self.provider = provider
        self.initWidget(self.outer)
        self.grid.setStyleName("table")
        self.outer.add(self.navbar, DockPanel.NORTH)
        self.outer.add(self.grid, DockPanel.CENTER)
        self.initTable(columns, columnStyles, rowCount)
        self.setStyleName("DynaTable-DynaTableWidget")

    def initTable(self, columns, columnStyles, rowCount):
        self.grid.resize(rowCount + 1, len(columns))
        for i in range(len(columns)):
            self.grid.setText(0, i, columns[i])
            if columnStyles:
                self.grid.cellFormatter.setStyleName(0, i, columnStyles[i] + "header")

    def setStatusText(self, text):
        self.navbar.status.setText(text)

    def clearStatusText(self, text):
        self.navbar.status.setHTML("&nbsp;")

    def refresh(self):
        self.navbar.gotoFirst.setEnabled(False)
        self.navbar.gotoPrev.setEnabled(False)
        self.navbar.gotoNext.setEnabled(False)

        self.setStatusText("Please wait...")
        self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor)

    def setRowCount(self, rows):
        self.grid.resizeRows(rows)

    def getDataRowCount(self):
        return self.grid.getRowCount() - 1
Esempio n. 35
0
    def __init__(self):
        Sink.__init__(self)
        self.curImage=0
        self.image=Image()
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
        self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
        self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]

        for i in range(len(self.sImages)):
            self.sImages[i]=self.baseURL() + self.sImages[i]
        
        self.image.addLoadListener(self)
        self.prevButton.addClickListener(self)
        self.nextButton.addClickListener(self)
        
        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.prevButton, DockPanel.WEST)
        topPanel.add(self.nextButton, DockPanel.EAST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)
        
        panel = VerticalPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
        panel.add(topPanel)
        panel.add(self.image)
        
        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.nextButton.setStyleName("ks-images-Button")
        self.prevButton.setStyleName("ks-images-Button")
        
        self.loadImage(0)           
Esempio n. 36
0
  def __init__(self):
    Composite.__init__(self)

    panel = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                      VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
    panel.setWidth("100%")

    vp = VerticalPanel()

    grid = FlexTable(CellPadding=4, CellSpacing=4)

    hp = HorizontalPanel()

    handle_n = NextHandle(self)
    handle_f = FinishHandle(self)
    handle_c = ClearHandle(self)

    self.next   = Button("Next",    handle_n, StyleName='button')
    self.finish = Button("Finish!", handle_f, StyleName='button')
    self.clear  = Button("Clear",   handle_c, StyleName='button')

    hp.add(self.clear)
    hp.add(self.finish)
    hp.add(self.next)
    hp.setWidth("70%")

    vp.add(Label("Content-Based Image Retrieval Using OPF", StyleName='label'))
    vp.add(grid)

    vp.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
    vp.add(hp)

    cols = 4
    for i in range(100):
      im = Image('images/cbir/%d.jpg' % random.randint(0, 1000),  Size=("200px", "150px"), StyleName='image-cool')
      grid.setWidget(int(i/cols), i%cols, im)

    panel.add(vp, DockPanel.CENTER)

    self.initWidget(panel)

    self.status = Label()
    vp.add(self.status)
Esempio n. 37
0
 def __init__(self):
     self.panel = DockPanel()
     self.userList = UserList(self)
     self.userForm = UserForm(self)
     self.rolePanel = RolePanel(self)
     self.panel.add(self.userList, DockPanel.NORTH)
     self.panel.add(self.userForm, DockPanel.WEST)
     self.panel.add(self.rolePanel, DockPanel.EAST)
     RootPanel().add(self.panel)
     self.Show()
Esempio n. 38
0
    def testDockAddCentre(self):
        self.d = DockPanel()
        RootPanel('tests').add(self.d)
        l = Label("Hello World (label)", StyleName='teststyle')
        self.d.add(l, DockPanel.CENTER)
        self.write_test_output('addcentrelabel')

        self.d.remove(l)
        self.write_test_output('removecentrelabel')

        l2 = Label("Hello World 2 (label)", StyleName='teststyle')

        self.d.add(l2, DockPanel.CENTER)
        self.write_test_output('addcentrelabel2')

        if not RootPanel('tests').remove(self.d):
            self.fail(
                "DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output('removedock')
Esempio n. 39
0
    def __init__(self, parent = None):
        
        PanelIFACE.__init__(self, parent)
        self.panel = VerticalPanel()
        self.panel.setBorderWidth(1)
        self.panel.setWidth("100%")
        # prepare panel
        self.prepareReduce = HTML("<tt> .. none yet .. </tt>", True, )

        self.recipeList = ListBox()
        self.recipeList.addChangeListener(getattr(self, "onRecipeSelected"))
        self.recipeList.addItem("None")
        HTTPRequest().asyncGet("recipes.xml",
                                RecipeListLoader(self))

        #EO prepare panel
        self.reduceCLPanel = DockPanel(Spacing = 5)
        self.reduceCLPanel.add(HTML("<i>Reduce Command Line</i>:"), DockPanel.NORTH)                        
        self.reduceCLPanel.add(self.prepareReduce, DockPanel.NORTH)

        self.reduceFilesPanel = DockPanel(Spacing = 5)
        self.reduceFilesPanel.add(HTML("<b>Datasets</b>:"), DockPanel.WEST)

        self.reduceFiles = ListBox()
        self.reduceFiles.setVisibleItemCount(5)
        self.reduceFilesPanel.add(self.reduceFiles, DockPanel.WEST)
        self.clearReduceFilesButton = Button("<b>Clear List</b>", listener = getattr(self, "onClearReduceFiles"))
        self.reduceFilesPanel.add(self.clearReduceFilesButton, DockPanel.SOUTH)

        self.recipeListPanel = DockPanel(Spacing = 5)
        self.recipeListPanel.add(HTML("<b>Recipes List</b>:"),DockPanel.WEST)
        self.recipeListPanel.add(self.recipeList, DockPanel.WEST)

        self.runReduceButton = Button("<b>RUN REDUCE</b>", listener = getattr(self, "onRunReduce"))

        self.adInfo = HTML("file info...")
        # major sub panels
        self.panel.add(self.reduceCLPanel)
        self.panel.add(self.reduceFilesPanel)
        self.panel.add(self.recipeListPanel)
        self.panel.add(self.runReduceButton)
        self.panel.add(self.adInfo)
Esempio n. 40
0
    def __init__(self):
        self.artist =''
        self.start_date = ''
        self.end_date = ''
        self.period_search =''
        self.search_option = 1
        #declare the general interface widgets
        self.panel = DockPanel(StyleName = 'background')
        self.ret_area = TextArea()
        self.ret_area.setWidth("350px")
        self.ret_area.setHeight("90px")
        self.options = ListBox()

        self.search_button = Button("Search", getattr(self, "get_result"), StyleName = 'button')

        #set up the date search panel; it has different text boxes for
        #to and from search dates
        self.date_search_panel = VerticalPanel()
        self.date_search_start = TextBox()
        self.date_search_start.addInputListener(self)
        self.date_search_end = TextBox()
        self.date_search_end.addInputListener(self)
        
        self.date_search_panel.add(HTML("Enter as month/day/year", True, StyleName = 'text'))
        self.date_search_panel.add(HTML("From:", True, StyleName = 'text'))
        self.date_search_panel.add(self.date_search_start)
        self.date_search_panel.add(HTML("To:", True, StyleName = 'text'))
        self.date_search_panel.add(self.date_search_end)
        #set up the artist search panel
        self.artist_search = TextBox()
        self.artist_search.addInputListener(self)
        self.artist_search_panel = VerticalPanel()
        self.artist_search_panel.add(HTML("Enter artist's name:",True,
                                          StyleName = 'text'))
        self.artist_search_panel.add(self.artist_search)

        #Put together the list timespan search options
        self.period_search_panel = VerticalPanel()
        self.period_search_panel.add(HTML("Select a seach period:",True,
                                          StyleName = 'text'))
        self.period_search = ListBox()
        self.period_search.setVisibleItemCount(1)
        self.period_search.addItem("last week")
        self.period_search.addItem("last month")
        self.period_search.addItem("last year")
        self.period_search.addItem("all time")
        self.period_search_panel.add(self.period_search)
        #add the listeners to the appropriate widgets
        self.options.addChangeListener(self)
        self.period_search.addChangeListener(self)
        self.ret_area_scroll = ScrollPanel()
        self.search_panel = HorizontalPanel()
        self.options_panel = VerticalPanel()
Esempio n. 41
0
    def onModuleLoad(self):

        self.remote = DataService()

        #Show the initial screen.
        initToken = History.getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)
Esempio n. 42
0
    def __init__(self, left=50, top=50):
        try:
            DialogBox.__init__(self, modal=False)

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("About")

            msg = HTML(
                """\
This is an example application, which uses PureMVC<br/>
<br/>
""", True)
            self.dockPanel.add(msg, DockPanel.CENTER)
            self.closeBtn = Button("Close", self)
            self.dockPanel.add(self.closeBtn, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise
Esempio n. 43
0
    def onModuleLoad(self):
        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()
        self.b = Button("load", self)

        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height - 110))

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        RootPanel().add(self.b)

        self.loadSinks()
Esempio n. 44
0
class DockPanelTest(UnitTest1):

    def testDockAdd(self):
        self.d = DockPanel()
        RootPanel('tests').add(self.d)
        self.write_test_output('adddockpanel')

        if not RootPanel('tests').remove(self.d):
            self.fail("DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output('removedockpanel')

    def testDockAddCentre(self):
        self.d = DockPanel()
        RootPanel('tests').add(self.d)
        l = Label("Hello World (label)", StyleName='teststyle')
        self.d.add(l, DockPanel.CENTER)
        self.write_test_output('addcentrelabel')

        self.d.remove(l)
        self.write_test_output('removecentrelabel')

        l2 = Label("Hello World 2 (label)", StyleName='teststyle')

        self.d.add(l2, DockPanel.CENTER)
        self.write_test_output('addcentrelabel2')

        if not RootPanel('tests').remove(self.d):
            self.fail("DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output('removedock')
Esempio n. 45
0
class HelpAboutDlg(DialogBox):

    def __init__(self, left = 50, top = 50):
        try:
            DialogBox.__init__(self, modal = False)

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("About")

            msg = HTML("""\
This is an example application, which uses PureMVC<br/>
<br/>
""", True)
            self.dockPanel.add(msg, DockPanel.CENTER)
            self.closeBtn = Button("Close", self)
            self.dockPanel.add(self.closeBtn, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise

    def onClick(self, sender):
        self.hide()
Esempio n. 46
0
class WebApp:
    def onModuleLoad(self):

        self.remote = DataService()

        #Show the initial screen.
        initToken = History.getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)

    def createPage(self, ref, html, title):
        htp = HTMLLinkPanel(html)
        htp.replaceLinks()
        htp.setWidth("100%")
        self.pages[ref] = htp

    def onHistoryChanged(self, token):
        #log.writebr("onHistoryChanged %s" % token)
        if self.pages.has_key(token):
            self.setPage(token)
            return
        self.remote.getPageByName(token, self)

    def setPage(self, ref):

        htp = self.pages[ref]
        if htp == self.current_page:
            return
        Window.setTitle(htp.title)
        if self.current_page:
            self.dock.remove(self.current_page)
        self.dock.add(htp, DockPanel.CENTER)
        self.current_page = htp

    def onRemoteResponse(self, response, request_info):
        if (request_info.method == 'getPageByName'
                or request_info.method == 'getPage'):
            item = response[0]
            html = item['fields']['text']
            token = item['fields']['name']
            self.createPage(token, html, token)
            self.setPage(token)

    def onRemoteError(self, code, message, request_info):
        RootPanel().add(
            HTML("Server Error or Invalid Response: ERROR " + str(code) +
                 " - " + str(message)))
Esempio n. 47
0
    def onModuleLoad(self):
        self.curInfo=''
        self.curSink=None
        self.description=HTML()
        self.sink_list=SinkList()
        self.panel=DockPanel()
        self.b=Button("load", self)
        
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height-110))

        vp=VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        #RootPanel().add(self.b)

        self.loadSinks()
Esempio n. 48
0
    def __init__(self, parent = None):
        Sink.__init__(self, parent)
        self.reduceFiles = []
        if True:
            HTTPRequest().asyncGet("datadir.xml", 
                                    DirDictLoader(self),
                                )
        dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, 
                            Spacing=10,
                             Size=("100%","100%"))
        self.dock = dock
        self.fProto = []

        self.fTree = Tree()
        self.treePanel = ScrollPanel()
        self.treePanel.setSize("100%", 
                                str(
                                 int(
                                  Window.getClientHeight()*.75
                                 )
                                )+"px")
        Window.addWindowResizeListener(self)
        
        self.treePanel.add(self.fTree)
        dock.add(self.treePanel, DockPanel.WEST)
        
        
        #self.treePanel.setBorderWidth(1)
        #self.treePanel.setWidth("100%")
        
        prPanel = self.createRightPanel()
        dock.add(prPanel,DockPanel.EAST)
        
        dock.setCellWidth(self.treePanel, "50%")
        dock.setCellWidth(prPanel, "50%")
        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)

        self.fTree.addTreeListener(self)
        self.initWidget(self.dock)
        
        if False: #self.parent.filexml != None:
            DirDictLoader(self).onCompletion(self.parent.filexml)
Esempio n. 49
0
    def __init__(self, width, height, gametype):
        """Initialize the GameCanvas and construct the layout

        :param width:  width of the game canvas in pixels
        :type width:  int
        :param height:  height of the game canvas in pixels
        :type height:  int
        :param gametype:  type of game to be loaded
        :type gametype:  str
        """
        DockPanel.__init__(self,HorizontalAlignment=HasAlignment.ALIGN_CENTER,Spacing=10)
        
        if gametype == 'Chess':
            self.game = Chess()
            self.boardtype = self.game.boardtype
            self.images = []
            for i in self.game.pieces:
                self.images.append('./images/Chess/'+str(i.player)+str(i.name)+'.svg')
            self.images = list(set(self.images))  #eliminate duplicates
            
        self.GC = GameCanvas(width, height, self.game)
        loadImages(self.images, self)
        self.GC.addMouseListener(self)
        
        self.b = Button("Make Move", self, StyleName='teststyle')
        self.cell1 = TextBox(StyleName='boxStyle')
        self.cell2 = TextBox(StyleName='boxStyle')

        self.cellPanel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        self.cellPanel.add(self.cell1)
        self.cellPanel.add(self.cell2)

        self.mover = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        self.mover.add(self.cellPanel)
        self.mover.add(self.b)
    
        self.add(self.GC, DockPanel.CENTER)
        self.add(self.mover, DockPanel.EAST)
Esempio n. 50
0
File: WebPage.py Progetto: Afey/pyjs
class WebApp:
    def onModuleLoad(self):

        self.remote = DataService()

        #Show the initial screen.
        initToken = History.getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)

    def createPage(self, ref, html, title):
        htp = HTMLLinkPanel(html)
        htp.replaceLinks()
        htp.setWidth("100%")
        self.pages[ref] = htp

    def onHistoryChanged(self, token):
        #log.debug("onHistoryChanged %s" % token)
        if self.pages.has_key(token):
            self.setPage(token)
            return
        self.remote.getPageByName(token, self)

    def setPage(self, ref):

        htp = self.pages[ref]
        if htp == self.current_page:
            return
        Window.setTitle(htp.title)
        if self.current_page:
            self.dock.remove(self.current_page)
        self.dock.add(htp, DockPanel.CENTER)
        self.current_page = htp

    def onRemoteResponse(self, response, request_info):
        if (request_info.method == 'getPageByName' or
           request_info.method == 'getPage'):
            item = response[0]
            html = item['fields']['text']
            token = item['fields']['name']
            self.createPage(token, html, token)
            self.setPage(token)

    def onRemoteError(self, code, message, request_info):
        RootPanel().add(HTML("Server Error or Invalid Response: ERROR " + str(code) + " - " + str(message)))
Esempio n. 51
0
	def __init__(self):
		self.DPanel = DockPanel(HorizontalAlignment = HasAlignment.ALIGN_CENTER,
						Spacing=10) # Creates the Docker Panel Instance
		self.VPanel = VerticalPanel() # Creates the Vertical Panel Instance
		self.VPanel1 = VerticalPanel() # Creates the Vertical Panel Instance
		self.HPanel = HorizontalPanel() # Creates a Horizontal Panel Instance
		self.HPanel1 = HorizontalPanel()# Creates a Horizontal Panel Instance


		self.image=Image()#Creates the Image instance to embed the images of dice
		self.DummyUrl = self.image.getUrl() 
		self.timer = Timer(notify=self.StillImage)#Timer for display of gif animation
		self.timerRButton =  Timer(notify=self.OneAlert)#Timer for controlling states of Roll button 
													#whenever the output of the dice is 1

		self.RollButton = Button("Roll", getattr(self, "RollButtonPressed")) #Initially Disabled 
		self.RollButton.setEnabled(False)
		self.BankButton = Button("Bank", getattr(self, "BankButtonPressed")) #Initially Disabled 
		self.BankButton.setEnabled(False)
		#The start button controls both the number players as well the winning score
		self.StartButton = Button("Start", getattr(self, "StartButtonPressed")) #Intially Enabled
		self.StartButton.setEnabled(True)


		self.PlayerNum = TextBox() #Enter the Number of Players
		self.WinScore = TextBox() #Enter the Target Score
		self.PlayerNum.setText("0")
		self.WinScore.setText("0")
		# self.OK = Button("OK", getattr(self, "okButtonPressed"))

		self.NameScore = FlexTable() #main score board
		self.NameScore.setStyleName("NameScore")
		self.TempBoard = FlexTable() #Temporary score board
		self.TempBoard.setStyleName("TempBoard")

		

		self.TxtInstructions = HTML()
Esempio n. 52
0
    def __init__(self, provider, columns, columnStyles, rowCount):
        Composite.__init__(self)

        self.acceptor = RowDataAcceptorImpl(self)
        self.outer = DockPanel()
        self.startRow = 0
        self.grid = Grid()
        self.navbar = NavBar(self)

        self.provider = provider
        self.initWidget(self.outer)
        self.grid.setStyleName("table")
        self.outer.add(self.navbar, DockPanel.NORTH)
        self.outer.add(self.grid, DockPanel.CENTER)
        self.initTable(columns, columnStyles, rowCount)
        self.setStyleName("DynaTable-DynaTableWidget")
Esempio n. 53
0
    def testDockAddCentre(self):
        self.d = DockPanel()
        RootPanel("tests").add(self.d)
        l = Label("Hello World (label)", StyleName="teststyle")
        self.d.add(l, DockPanel.CENTER)
        self.write_test_output("addcentrelabel")

        self.d.remove(l)
        self.write_test_output("removecentrelabel")

        l2 = Label("Hello World 2 (label)", StyleName="teststyle")

        self.d.add(l2, DockPanel.CENTER)
        self.write_test_output("addcentrelabel2")

        if not RootPanel("tests").remove(self.d):
            self.fail("DockPanel added but apparently not owned by RootPanel()")
        self.write_test_output("removedock")
Esempio n. 54
0
class PopupFrame(DialogBoxModal):

    def __init__(self, identifier, title, iframe):
        if modal_popups.has_key(identifier):
            return
        modal_popups[identifier] = self

        DialogBoxModal.__init__(self, identifier)

        self.setText(title)

        self.iframe = iframe
        #closeButton = Button('Close', self)
        #msg = HTML('<center>IFRAME:</center>', True)
        self.iframe.setStyleName('gwt-DialogFrame')
        
        self.dock = DockPanel()
        self.dock.setSpacing(4)
        
        #dock.add(closeButton, DockPanel.SOUTH)
        #dock.add(msg, DockPanel.NORTH)
        self.dock.add(self.iframe, DockPanel.CENTER)
        
        #dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        self.dock.setCellWidth(self.iframe, '100%')
        self.dock.setWidth('100%')
        #self.iframe.setWidth('320px')
        #self.iframe.setHeight('200px')
        self.setWidget(self.dock)

    def setUrl(self, url):
        self.iframe.setUrl(url)

    def onClick(self, sender):
        self.hide()

    def set_width(self, width):
        self.iframe.setWidth('%dpx' % width) 

    def set_height(self, height):
        self.iframe.setHeight('%dpx' % height)
Esempio n. 55
0
    def __init__(self):
        Sink.__init__(self)
        self.curImage = 0
        self.image = Image()
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
        self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
        self.sImages = [
            "rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg",
            "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg",
            "rembrandt/TheArtistInHisStudio.jpg",
            "rembrandt/TheReturnOfTheProdigalSon.jpg"
        ]

        for i in range(len(self.sImages)):
            self.sImages[i] = self.baseURL() + self.sImages[i]

        self.image.addLoadListener(self)
        self.prevButton.addClickListener(self)
        self.nextButton.addClickListener(self)

        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.prevButton, DockPanel.WEST)
        topPanel.add(self.nextButton, DockPanel.EAST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)

        panel = VerticalPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
        panel.add(topPanel)
        panel.add(self.image)

        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.nextButton.setStyleName("ks-images-Button")
        self.prevButton.setStyleName("ks-images-Button")

        self.loadImage(0)
Esempio n. 56
0
class gmTopLevelLayer:
    
    def onModuleLoad(self):

        GMWevents.init_events()
        GMWevents.events.addLoginListener(self) # want to receive onLogin

        self.TEXT_ERROR = "Server Error"
        self.loginpanel = cLoginPanel() # fires logged out on UI load
        self.afterloginpanel = cMainPanel()

        self.maindisplay = DockPanel(
                          HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                          VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                          BorderWidth=1,
                          Padding=8,
                          Width="100%") 

        RootPanel().add(self.maindisplay)

    def onLogin(self, sender, username, logged_in):
        if logged_in:
            self.logged_in(username)
        else:
            self.logged_out()

    def logged_out(self):
        self.login_username = None
        self.loginpanel.setStatus("") # reset status display
        if self.maindisplay.center is not None:
            self.maindisplay.remove(self.afterloginpanel.getPanel())
        self.maindisplay.add(self.loginpanel.getPanel(), DockPanel.CENTER)

    def logged_in(self, username):
        self.login_username = username
        if self.maindisplay.center is not None:
            self.maindisplay.remove(self.loginpanel.getPanel())
        self.maindisplay.add(self.afterloginpanel.getPanel(), DockPanel.CENTER)
Esempio n. 57
0
class AppFrame(object):

    userForm = None
    userList = None
    rolePanel = None

    def __init__(self):
        self.panel = DockPanel()
        self.userList = UserList(self)
        self.userForm = UserForm(self)
        self.rolePanel = RolePanel(self)
        self.panel.add(self.userList, DockPanel.NORTH)
        self.panel.add(self.userForm, DockPanel.WEST)
        self.panel.add(self.rolePanel, DockPanel.EAST)
        RootPanel().add(self.panel)
        self.Show()

    def Show(self):
        pass
Esempio n. 58
0
class LoginWindow(DialogBox, ZillaWindow):
    def __init__(self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        DialogBox.__init__(self, kwargs)
        self.dockPanel = DockPanel()
        self.dockPanel.setSpacing(4)

        self.setText("Logowanie")

        hpanel1 = HorizontalPanel()

        login = TextBox()
        login.setText("Login")
        #hpanel1.add(login)

        passwd = TextBox()
        passwd.setText("Hasło")

        self.dockPanel.add(login, DockPanel.NORTH)
        self.dockPanel.add(passwd, DockPanel.NORTH)

        #hpanel1.add(passwd)

        #self.add(hpanel1)

        self.add(login)
        self.add(passwd)

    def login(self):
        return True

    def join_game(self):
        return True

    def quit(self):
        return True
Esempio n. 59
0
    def onModuleLoad(self):
        loggedInUser = getCookie("LoggedInUser")
        loggedInUserJsonData = json.loads(loggedInUser)

        self.username = loggedInUserJsonData["username"]

        self.remote_py = MyBlogService()

        dockPanel = DockPanel(BorderWidth=0,
                              Padding=0,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE)

        dockPanel.setSize('100%', '100%')

        headerDockPanel = DockPanel(
            BorderWidth=0,
            Padding=0,
            HorizontalAlignment=HasAlignment.ALIGN_LEFT,
            VerticalAlignment=HasAlignment.ALIGN_CENTER)
        headerDockPanel.setStyleName('header')
        headerDockPanel.setWidth('100%')

        dockPanel.add(headerDockPanel, DockPanel.NORTH)
        dockPanel.setCellHeight(headerDockPanel, '60px')

        self.siteImage = Image("/images/Testware_logo.png")
        self.siteImage.setStyleName('logo-image')
        headerDockPanel.add(self.siteImage, DockPanel.WEST)
        headerDockPanel.setCellWidth(self.siteImage, '30%')

        self.pageTitle = Label('New Blog')
        self.pageTitle.setStyleName('center-header')
        headerDockPanel.add(self.pageTitle, DockPanel.CENTER)
        headerDockPanel.setCellWidth(self.pageTitle, '40%')

        rightHeaderPanel = VerticalPanel(StyleName='right-header')
        headerDockPanel.add(rightHeaderPanel, DockPanel.EAST)
        headerDockPanel.setCellWidth(rightHeaderPanel, '30%')

        welcomeNoteLabel = Label('Hi %s %s!' %
                                 (loggedInUserJsonData["first_name"],
                                  loggedInUserJsonData["last_name"]))
        rightHeaderPanel.add(welcomeNoteLabel)

        logoutAnchor = Anchor(Widget=HTML('Logout'), Href='/', Title='Logout')
        logoutAnchor.setStyleName('logout')
        rightHeaderPanel.add(logoutAnchor)

        panel = HorizontalPanel(StyleName="header2")
        dockPanel.add(panel, DockPanel.NORTH)
        dockPanel.setCellHeight(panel, '50px')

        self.blogTitle = TextBox()
        self.blogTitle.setStyleName('blog-title')
        self.blogTitle.setPlaceholder("Blog Title")
        panel.add(self.blogTitle)

        self.blogContent = TextArea()
        self.blogContent.setStyleName('blog-content')

        dockPanel.add(self.blogContent, DockPanel.CENTER)
        createBlogButton = Button("Create Blog", self)
        createBlogButton.setStyleName('btn')
        panel.add(createBlogButton)

        RootPanel().add(dockPanel)