Exemplo n.º 1
0
    def __init__(self, tabBar=None, *kwargs):
        TabPanel.__init__(self, tabBar, *kwargs)
        self.parent_buoy = None

        self.tabs = [{'hovertype' : ListBox(), 'name' : 'Cost'},
                     {'hovertype' : ListBox(), 'name' : 'Speed'}]

        self.cost = self.tabs[0]['hovertype']
        items = ['cheap','next to cheap','average','above average','expensive','if you have to ask']
        self.cost.setVisibleItemCount(len(items))
        for item in items:
            self.cost.addItem(item)
        self.cost.addChangeListener(self)

        self.speed = self.tabs[1]['hovertype']
        items = ['very slow','slow','average','above average','fast','quick','hyper','turbo','lightening','light']
        self.speed.setVisibleItemCount(len(items))
        for item in items:
            self.speed.addItem(item)
        self.speed.addChangeListener(self)

        for tab in self.tabs:
            h = HorizontalPanel()
            h.add(tab['hovertype'])
            self.add(h, tab['name'])
Exemplo n.º 2
0
def panel ( ui ):
    """ Creates a panel-based user interface for a specified UI object.
    """
    # Bind the context values to the 'info' object:
    ui.info.bind_context()

    # Get the content that will be displayed in the user interface:
    content = ui._groups
    nr_groups = len(content)

    if nr_groups == 0:
        panel = None
    if nr_groups == 1:
        panel = _GroupPanel(content[0], ui).control
    elif nr_groups > 1:
        panel = TabPanel()
        _fill_panel(panel, content, ui)
        panel.ui = ui

    # If the UI is scrollable then wrap the panel in a scroll area.
    if ui.scrollable and panel is not None:
        sp = ScrollPanel()
        sp.add(panel)
        panel = sp

    return panel
Exemplo n.º 3
0
 def add(self, tab, text, closable=False):
     t = text
     if closable:
         t += " <a href\=""about:black\" onClick=\"document.modules.main.main.tps.get(%d).removeByKey(%d); return false;\">[x]</a>"%(self.id,self.key)
     TabPanel.add(self, tab, t, closable)
     tab.key = self.key
     self.k2w[self.key]=tab
     self.key+=1
Exemplo n.º 4
0
 def __init__(self):
     global tps
     global tpid
     tps[tpid] = self
     self.id = tpid
     tpid += 1
     self.k2w = {}
     self.key=0
     TabPanel.__init__(self)
    def __init__(self, **kwargs):
        if not kwargs.has_key('StyleName'): kwargs['StyleName']=self.DEFAULT_STYLENAME
        if kwargs.has_key('TabBar'):
            tabbar = kwargs.pop('TabBar')
        else:
            tabbar = DecoratedTabBar()
        TabPanel.__init__(self, tabbar, **kwargs)

        self.getTabBar().setStyleName(DecoratedTabBar.STYLENAME_DEFAULT)
Exemplo n.º 6
0
    def __init__(self, tabBar=None, **kwargs):
        TabPanel.__init__(self, tabBar, **kwargs)
        self.buoy = None

        # 3 tabs but only Hovercraft() has complexity
        self.tabs = [{'tab' : Hovercraft(), 'name' : 'Hovercraft'},
                     {'tab' : Ships(), 'name' : 'Ship'},
                     {'tab' : Surfboard(), 'name' : 'Surfboard'}]

        for tab in self.tabs:
            self.add(tab['tab'], tab['name'])
Exemplo n.º 7
0
    def __init__(self):
        SimplePanel.__init__(self)

        tabs = TabPanel(Width="100%", Height="250px")
        tabs.add(HTML("The quick brown fox jumps over the lazy dog."), "Tab 1")
        tabs.add(HTML("The early bird catches the worm."), "Tab 2")
        tabs.add(HTML("The smart money is on the black horse."), "Tab 3")

        tabs.selectTab(0)

        self.add(tabs)
Exemplo n.º 8
0
 def __init__(self):
     TabPanel.__init__(self, StyleName='tab-panel', Width='100%')
     loginPanel = login.LoginPanel()
     topPanel = toppanel.TopPanel(loginPanel)
     self.simple = simple.Simple(topPanel)
     self.intermediate = intermediate.Intermediate(topPanel)
     self.advanced = advanced.Advanced(topPanel)
     self.about = about.About(topPanel)
     
     self.add(self.simple, 'Simple')
     self.add(self.intermediate, 'Intermediate')
     self.add(self.advanced, 'Advanced')
     self.add(self.about, 'About')
     self.add(HTML('&nbsp;'), None)
     self.add(HTML('&nbsp'), loginPanel)
Exemplo n.º 9
0
    def onModuleLoad(self):
        self.tabs = TabPanel()
        tab_overview=TabContainer()
        self.tabs.add(tab_overview, 'Overview')

        self.tab_events=TabRaphaelContainer()
        self.tab_events.set_headline('Events Example')
        self.tab_events.set_raphael(events.Events(width=600,height=300))
        self.tab_events.set_status('Execute events on Raphael Elemnts')
        self.tabs.add(self.tab_events, 'Events')

        self.tab_graffle=TabRaphaelContainer()
        self.tab_graffle.set_headline('This is a simple example of the Raphael Graffle')
        self.tab_graffle.set_raphael(graffle.Graffle(width=600,height=300))
        self.tabs.add(self.tab_graffle, 'Graffle')

        self.tab_spinner=TabRaphaelContainer()
        self.tab_spinner.set_headline('This Raphael Spinner Example')
        self.tab_spinner.set_raphael(spinner.Spinner(width=600,height=300))
        self.tabs.add(self.tab_spinner, 'Spinner')

        self.tabs.selectTab(0)
        self.tabs.setWidth("100%")
        self.tabs.setHeight("100%")
        RootPanel().add(self.tabs)
Exemplo n.º 10
0
    def __init__(self):
        self.remote_case = CaseService()

        self.base_panel = VerticalPanel()
        self.tab_panel = TabPanel()
        self.base_panel.add(self.tab_panel)
        self.tab_panel.add(self.get_case_panel(), "Case")
        self.tab_panel.add(self.get_buses_panel(), "Buses")
        self.tab_panel.selectTab(0)
        self.status = Label()
        self.base_panel.add(self.status)
        RootPanel().add(self.base_panel)
Exemplo n.º 11
0
    def __init__(self):
        Sink.__init__(self)

        self.fTabs = TabPanel()
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
        self.fTabs.selectTab(0)

        self.fTabs.setWidth("100%")
        self.fTabs.setHeight("100%")
        self.initWidget(self.fTabs)
Exemplo n.º 12
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()
Exemplo n.º 13
0
    def onTabSelected(self, sender, tabIndex):
        page_name = self.tabs[tabIndex]['name']

        buoy = self.parent_buoy.new(page_name,
                                    {page_name : None})
        
        
        if tabIndex == 0:
            buoy.navigate()
            self.tabs[tabIndex]['tab'].set(buoy)
        else:
            buoy.end()

        return TabPanel.onTabSelected(self, sender, tabIndex)
Exemplo n.º 14
0
    def onTabSelected(self, sender, tabIndex):
        page_name = self.tabs[tabIndex]['name']
        self.buoy = self.parent_buoy.new(page_name,
                                         {'hovertype' : self.tabs[tabIndex]['name']})
        params = self.buoy.navigate()
        if 'hovertype' in params:
            if params['hovertype'] == 'Cost':
                self.set_cost(self.buoy)
            elif params['hovertype'] == 'Speed':
                self.set_speed(self.buoy)
        else:
            self.set_cost(self.buoy)

        return TabPanel.onTabSelected(self, sender, tabIndex)
Exemplo n.º 15
0
    def __init__(self):
        """ Constructs a new OpenPowerSystem instance.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.base_panel = HorizontalPanel()

        self.tab_panel = TabPanel()
        self.tab_panel.add(self.get_upload_panel(), "Upload")
#        self.tab_panel.add(self.get_home_panel(), "OpenPowerSystem")
#        self.tab_panel.add(self.get_map_panel(), "Map")
#        self.tab_panel.add(self.get_edit_panel(), "Edit")
        self.tab_panel.selectTab(0)

        self.base_panel.add(self.tab_panel)

        RootPanel().add(self.base_panel)
Exemplo n.º 16
0
 def make_tabs(self):
     tabs = TabPanel()
     tabs.add(self.make_alarm_widget(), 'alarms')
     tabs.add(self.make_test_widget(), 'test')
     tabs.selectTab(0)
     return tabs
Exemplo n.º 17
0
    def onModuleLoad(self):
        self.popupsubtraca = PopupSub(id="sub",datasrc="fsubtracao.pjs")
        self.popupsoma = PopupSoma(id="soma",datasrc="fsoma.pjs")
        self.popupmultescalar = PopupEscalar(id="escalar",datasrc="fmultescalar.pjs")
        self.popupmult = PopupProduto(id="mult",datasrc="fmult.pjs")
        self.popupsoma.iniciado = False;

        tabpanel = TabPanel()
        grid = Grid(4,2)
        imgbtnSoma =  Image("images/Soma_Matriz_sum_matrix.png",StyleName="gwt-ImageButton")
        imgbtnSubtracao =  Image("images/subtracao_Matriz_subtract_matrix.png",StyleName="gwt-ImageButton")
        imgbtnMultiplicacao =  Image("images/multiplicacao_Matriz_product_matrix.png",StyleName="gwt-ImageButton")
        imgbtnMultiplicacaoPorEscalar =  Image("images/multiplicacao_por_escalar.png",StyleName="gwt-ImageButton")
        
        #eventos
        imgbtnSoma.addClickListener(self.onSomaButtonClick)
        imgbtnSubtracao.addClickListener(self.onSubtracaoButtonClick)
        imgbtnMultiplicacao.addClickListener(self.onMultiplicacaoButtonClick)
        imgbtnMultiplicacaoPorEscalar.addClickListener(self.onMulPorEscalarButtonClick)
        
        contents = VerticalPanel()
        contents.setSpacing(4)
        contents.add(HTML('You can place any contents you like in a dialog box.'))
        
        grid.setWidget(0,0,imgbtnSoma)
        grid.setWidget(0,1,imgbtnSubtracao)
        grid.setWidget(2,0,imgbtnMultiplicacao)
        grid.setWidget(2,1,imgbtnMultiplicacaoPorEscalar)
        
        grid.setStyleName(element)
        tabpanel.add(HTML("Modulo de introducao a matrizes"),"<h2>Modulo de introducao a Matrizes</h2>", True)
        tabpanel.add(grid,"<h2>  Matrizes  </h2>", True)
        tabpanel.add(HTML("Modulo de introducao a matrizes"),"<h2>Ajuda para usar a ferramenta</h2>", True)
        tabpanel.setSize("90%"," 70%")
        
        tabpanel.selectTab(1)
        #self.popupsoma.show()
        
        RootPanel("conteudo").add(tabpanel)
Exemplo n.º 18
0
Arquivo: Tabs.py Projeto: Afey/pyjs
class Tabs(Sink):
    def __init__(self):
        Sink.__init__(self)

        self.fTabs = TabPanel()
        self.fTabs.addTabListener(self)
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662 (disabled)")
        self.fTabs.selectTab(0)

        self.fTabs.setWidth("100%")
        self.fTabs.setHeight("100%")
        self.initWidget(self.fTabs)

    def onShow(self):
        pass

    def createImage(self, imageUrl):
        image = Image(imageUrl)
        image.setStyleName("ks-images-Image")

        p = VerticalPanel()
        p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        p.add(image)
        return p

    def onBeforeTabSelected(self, sender, tabIndex):
        # Returning False disables the tab.
        if tabIndex == 4:
            return False
        return True

    def onTabSelected(self, sender, tabIndex):
        bar = self.fTabs.getTabBar()
        if tabIndex == 0:
            bar.getTabWidget(0).setText('1634 (selected)')
        else:
            bar.getTabWidget(0).setText('1634 (not selected)')
Exemplo n.º 19
0
    def __init__(self, **kwargs):
        if not kwargs.has_key('StyleName'): kwargs['StyleName']=self.DEFAULT_STYLENAME
        TabPanel.__init__(self, DecoratedTabBar(), **kwargs)

        self.getTabBar().setStyleName(DecoratedTabBar.STYLENAME_DEFAULT)
Exemplo n.º 20
0
class Pylon:
    def __init__(self):
        self.remote_case = CaseService()

        self.base_panel = VerticalPanel()
        self.tab_panel = TabPanel()
        self.base_panel.add(self.tab_panel)
        self.tab_panel.add(self.get_case_panel(), "Case")
        self.tab_panel.add(self.get_buses_panel(), "Buses")
        self.tab_panel.selectTab(0)
        self.status = Label()
        self.base_panel.add(self.status)
        RootPanel().add(self.base_panel)


    def get_case_panel(self):
        panel = VerticalPanel()
        title = HTML("""Case""")
        panel.add(title)
        tree = self.get_case_tree()
        panel.add(tree)
        return panel


    def get_case_tree(self):
        tree = self.tree = Tree()
        case_item = TreeItem("Case_1")
        tree.addItem(case_item)
        buses = self.buses = TreeItem("Buses")
        case_item.addItem(buses)
        id = self.remote_case.buses("name", self)
        return tree


    def create_item(self, proto):
        proto.item = TreeItem(proto.text)
        proto.item.setUserObject(proto)
        if len(proto.children) > 0:
            proto.item.addItem(PendingItem())



    def get_buses_panel(self):
        panel = VerticalPanel()
        title = HTML("""Buses""")
        panel.add(title)
        return panel

    # JSON handler interface --------------------------------------------------

    # The handler object should implement
    #     onRemoteResponse(value, requestInfo)
    # to accept the return value of the remote method, and
    #     onRemoteError(code, error_dict, requestInfo)
    #          code = http-code or 0
    #          error_dict is an jsonrpc 2.0 error dict:
    #              {
    #                'code': jsonrpc-error-code (integer) ,
    #                'message': jsonrpc-error-message (string) ,
    #                'data' : extra-error-data
    #              }
    # to handle errors.

    def onRemoteResponse(self, response, request_info):
        print "RESPONSE:", response
#        self.tree.clear()
        self.buses.removeItems()
        for bus_name in response:
            proto = Proto(str(bus_name))
            self.create_item(proto)
            self.buses.addItem(proto.item)


    def onRemoteError(self, code, errobj, request_info):
        print "ERROR:", errobj['message']

        message = errobj['message']
        if code != 0:
            self.status.setText("HTTP error %d: %s" % (code, message))
        else:
            code = errobj['code']
            self.status.setText("JSONRPC Error %s: %s" % (code, message))
Exemplo n.º 21
0
class OpenPowerSystem:
    """ Defines the main panel for OpenPowerSystem.
    """

    def __init__(self):
        """ Constructs a new OpenPowerSystem instance.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.base_panel = HorizontalPanel()

        self.tab_panel = TabPanel()
        self.tab_panel.add(self.get_upload_panel(), "Upload")
#        self.tab_panel.add(self.get_home_panel(), "OpenPowerSystem")
#        self.tab_panel.add(self.get_map_panel(), "Map")
#        self.tab_panel.add(self.get_edit_panel(), "Edit")
        self.tab_panel.selectTab(0)

        self.base_panel.add(self.tab_panel)

        RootPanel().add(self.base_panel)


    def get_home_panel(self):
        panel = VerticalPanel()

        title = HTML("""OpenPowerSystem""")
        panel.add(title)

        subtitle = HTML("""The Open Power System data repository.""")
        panel.add(subtitle)

        return panel


#    def get_map_panel(self):
#        panel = VerticalPanel()
#
#        self.map = OpenMap(Width="900px", Height="900px")
#        panel.add(self.map)
#
#        self.wms = OpenWMSLayer("OpenLayers WMS",
#            "http://labs.metacarta.com/wms/vmap0", layers="basic")
#        self.map.addLayer(self.wms)
#
#        return panel


#    def get_edit_panel(self):
#        edit_page = edit_panel.EditPanel()
#        return edit_page.panel


    def get_upload_panel(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/upload")

        # Add an event handler to the form.
        handler = UploadFormHandler()
        handler.form = self.form
        self.form.addFormHandler(handler)

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.setStyleName("panel") # same name as in OpenPowerSystem.css.
        self.form.setWidget(panel)

        info = HTML(r'Upload CIM RDF/XML instance file.')
        panel.add(info)

        # Create a list box for choice of profile.
        self.profiles = [("UCTE (CIM 14)", "ucte"),
                         ("CPSM (CIM13)", "cpsm"),
                         ("CDPSM (CIM 14)", "cdpsm"),
                         ("Dynamics (CIM 14)", "dynamics")]
        self.profile = ListBox(VisibleItemCount=1)
        self.profile.setName("profileType")
        for n, v in self.profiles:
            self.profile.addItem(n, v)
        panel.add(self.profile)

        # Create a FileUpload widget.
        rdfxml_file = FileUpload()
        rdfxml_file.setName("uploadFormElement")
        panel.add(rdfxml_file)

        # Add a 'submit' button.
        upload = Button("Upload", handler)
        panel.add(upload)

        return self.form
Exemplo n.º 22
0
class Tabs(Sink):
    def __init__(self):
        Sink.__init__(self)

        self.fTabs = TabPanel()
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
        self.fTabs.selectTab(0)

        self.fTabs.setWidth("100%")
        self.fTabs.setHeight("100%")
        self.initWidget(self.fTabs)

    def onShow(self):
        pass

    def createImage(self, imageUrl):
        image = Image(imageUrl)
        image.setStyleName("ks-images-Image")

        p = VerticalPanel()
        p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        p.add(image)
        return p