当前位置: 首页>>代码示例>>Python>>正文


Python HorizontalPanel.setStyleName方法代码示例

本文整理汇总了Python中pyjamas.ui.HorizontalPanel.HorizontalPanel.setStyleName方法的典型用法代码示例。如果您正苦于以下问题:Python HorizontalPanel.setStyleName方法的具体用法?Python HorizontalPanel.setStyleName怎么用?Python HorizontalPanel.setStyleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.HorizontalPanel.HorizontalPanel的用法示例。


在下文中一共展示了HorizontalPanel.setStyleName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
    def __init__(self):

        Composite.__init__(self)

        self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>")
        self.aboutLink = HTML("<a href='javascript:;'>About</a>")

        outer = HorizontalPanel()
        inner = VerticalPanel()

        outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)

        links = HorizontalPanel()
        links.setSpacing(4)
        links.add(self.signOutLink)
        links.add(self.aboutLink)

        outer.add(inner)
        inner.add(HTML("<b>Welcome back, [email protected]</b>"))
        inner.add(links)

        self.signOutLink.addClickListener(self)
        self.aboutLink.addClickListener(self)

        self.initWidget(outer)
        inner.setStyleName("mail-TopPanel")
        links.setStyleName("mail-TopPanelLinks")
开发者ID:Afey,项目名称:pyjs,代码行数:30,代码来源:TopPanel.py

示例2: setControls

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
 def setControls(self, minimize, maximize, close):
     if minimize is True:
         self.minimizeWidget = self.createDefaultControl('minimize')
     elif isinstance(minimize, basestring):
         self.minimizeWidget = Image(minimize)
     else:
         self.minimizeWidget = minimize
     if maximize is True:
         self.maximizeWidget = self.createDefaultControl('maximize')
     elif isinstance(maximize, basestring):
         self.maximizeWidget = Image(maximize)
     else:
         self.maximizeWidget = maximize
     if close is True:
         self.closeWidget = self.createDefaultControl('close')
     elif isinstance(close, basestring):
         self.closeWidget = Image(close)
     else:
         self.closeWidget = close
     if (isinstance(self.minimizeWidget, UIObject) or
         isinstance(self.maximizeWidget, UIObject) or
         isinstance(self.closeWidget, UIObject)):
         cf = self.panel.getCellFormatter()
         captionStyle = self.caption.getStyleName()
         captionPanel = FlexTable(
             Width="99%",
             BorderWidth="0",
             CellPadding="0",
             CellSpacing="0",
         )
         controls = HorizontalPanel()
         controls.setStyleName("Controls")
         controls.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
         if isinstance(self.minimizeWidget, UIObject):
             self.minimizeWidget.setStyleName("Minimize")
             controls.add(self.minimizeWidget)
             self.minimizeWidget.addClickListener(
                 getattr(self, "onMinimize"),
             )
         if isinstance(self.maximizeWidget, UIObject):
             self.maximizeWidget.setStyleName("Maximize")
             controls.add(self.maximizeWidget)
             self.maximizeWidget.addClickListener(
                 getattr(self, "onMaximize"),
             )
         if isinstance(self.closeWidget, UIObject):
             self.closeWidget.setStyleName("Close")
             controls.add(self.closeWidget)
             self.closeWidget.addClickListener(
                 getattr(self, "onClose"),
             )
             self.closeable = True
         self.caption.removeStyleName(captionStyle)
         self.panel.setWidget(0, 0, captionPanel)
         captionPanel.setWidget(0, 0, self.caption)
         captionPanel.setWidget(0, 1, controls)
         captionPanel.setStyleName(captionStyle)
         cf = captionPanel.getCellFormatter()
         cf.setWidth(0, 1, '1%')
开发者ID:anthonyrisinger,项目名称:translate-pyjs-org.appspot.com,代码行数:61,代码来源:DialogWindow.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
class pjBallot:
    
    def __init__(self):
        self.mainPanel = VerticalPanel()
        self.contest = HorizontalPanel()
        self.contest.setStyleName('words')
        self.selection = HorizontalPanel()
        self.selection.setStyleName('words')
        self.button = Button('test', self.test)
        self.x = 1
    
    def test(self):
        self.button.setText("No, really click me!")
#        Window.alert("Hello, AJAAAX!")
        self.contest.add(HTML('yay'))

    def nextContest(self):
        self.x += 1
        self.contest.clear()
        self.contest.add(HTML('<b /> Contest: %d' % self.x))

    def nextSelection(self):
        self.x += 1
        self.selection.clear()
        self.selection.add(HTML('<b /> Selection: %d' % self.x))
    
    def onKeyDown(self, sender, keycode, modifiers):
        pass

    def onKeyUp(self, sender, keycode, modifiers):
        pass

    def onKeyPress(self, sender, keycode, modifiers):
        DOM.eventPreventDefault(DOM.eventGetCurrentEvent()) #not needed
        if keycode == KeyboardListener.KEY_UP:
            self.nextContest()
        if keycode == KeyboardListener.KEY_DOWN:
            self.nextContest()
        if keycode == KeyboardListener.KEY_LEFT:
            self.nextSelection()
        if keycode == KeyboardListener.KEY_RIGHT:
            self.nextSelection()

    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)
开发者ID:kurifu,项目名称:Old-CMUSV-Voting,代码行数:59,代码来源:pjBallot.py

示例4: fieldPanel

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
	def fieldPanel(self, widgets):
		h = HorizontalPanel()
		h.setStyleName('field')
		l = Label()
		for i in range(len(widgets)):
			if i==0:
				if 'name' in widgets[0]['kwargs']:
					l = Label(widgets[0]['kwargs']['name'])
				h.add(l)
			_i = i
			if isinstance(widgets[i], int): 
				_i = widgets[i]
			w = LWidget.make(widgets[_i]['w'], **widgets[_i]['kwargs'])
			h.add(w)
		return h 
开发者ID:molhokwai,项目名称:libraries,代码行数:17,代码来源:RunForm.py

示例5: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
    def __init__(self, mailObject):
        Composite.__init__(self)

        self.countLabel = HTML()
        self.newerButton = HTML("<a href='javascript:;'>&lt; newer</a>", True)
        self.olderButton = HTML("<a href='javascript:;'>older &gt;</a>", True)
        self.startIndex = 0
        self.selectedRow = -1
        self.table = FlexTable()
        self.navBar = HorizontalPanel()
        self.mailObject = mailObject

        # Setup the table.
        self.table.setCellSpacing(0)
        self.table.setCellPadding(2)
        self.table.setWidth("100%")

        # Hook up events.
        self.table.addTableListener(self)
        self.newerButton.addClickListener(self)
        self.olderButton.addClickListener(self)

        # Create the 'navigation' bar at the upper-right.
        innerNavBar = HorizontalPanel()
        innerNavBar.setStyleName("mail-ListNavBar")
        innerNavBar.setSpacing(8)
        innerNavBar.add(self.newerButton)
        innerNavBar.add(self.countLabel)
        innerNavBar.add(self.olderButton)

        self.navBar.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        self.navBar.add(innerNavBar)
        self.navBar.setWidth("100%")

        self.initWidget(self.table)
        self.setStyleName("mail-List")

        self.initTable()
        self.update()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:41,代码来源:MailList.py

示例6: MailList

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
class MailList(Composite):

    VISIBLE_EMAIL_COUNT = 10

    def __init__(self, mailObject):
        Composite.__init__(self)

        self.countLabel = HTML()
        self.newerButton = HTML("<a href='javascript:;'>&lt; newer</a>", True)
        self.olderButton = HTML("<a href='javascript:;'>older &gt;</a>", True)
        self.startIndex = 0
        self.selectedRow = -1
        self.table = FlexTable()
        self.navBar = HorizontalPanel()
        self.mailObject = mailObject

        # Setup the table.
        self.table.setCellSpacing(0)
        self.table.setCellPadding(2)
        self.table.setWidth("100%")

        # Hook up events.
        self.table.addTableListener(self)
        self.newerButton.addClickListener(self)
        self.olderButton.addClickListener(self)

        # Create the 'navigation' bar at the upper-right.
        innerNavBar = HorizontalPanel()
        innerNavBar.setSpacing(8)
        innerNavBar.add(self.newerButton)
        innerNavBar.add(self.countLabel)
        innerNavBar.add(self.olderButton)

        self.navBar.setStyleName("mail-ListNavBar")
        self.navBar.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        self.navBar.add(innerNavBar)
        self.navBar.setWidth("100%")

        self.initWidget(self.table)
        self.setStyleName("mail-List")

        self.initTable()
        self.update()

    def onCellDoubleClicked(self, sender, row, cell):
    	pass

    def onCellClicked(self, sender, row, cell):
        # Select the row that was clicked (-1 to account for header row).
        if (row > 0):
            self.selectRow(row - 1)

    def onClick(self, sender):
        if (sender == self.olderButton):
            # Move forward a page.
            self.startIndex = self.startIndex + MailList.VISIBLE_EMAIL_COUNT
            if (self.startIndex >= MailItems().getMailItemCount()):
                self.startIndex = self.startIndex - MailList.VISIBLE_EMAIL_COUNT
            else:
                self.styleRow(self.selectedRow, False)
                self.selectedRow = -1
                self.update()

        elif (sender == self.newerButton):
            # Move back a page.
            self.startIndex = self.startIndex - MailList.VISIBLE_EMAIL_COUNT
            if (self.startIndex < 0):
                self.startIndex = 0
            else:
                self.styleRow(self.selectedRow, False)
                self.selectedRow = -1
                self.update()

    def initTable(self):
        # Create the header row.
        self.table.setText(0, 0, "sender")
        self.table.setText(0, 1, "email")
        self.table.setText(0, 2, "subject")
        self.table.setWidget(0, 3, self.navBar)
        self.table.getRowFormatter().setStyleName(0, "mail-ListHeader")

        # Initialize the rest of the rows.
        i = 0
        while i < MailList.VISIBLE_EMAIL_COUNT:
            self.table.setText(i + 1, 0, "")
            self.table.setText(i + 1, 1, "")
            self.table.setText(i + 1, 2, "")
            self.table.getCellFormatter().setWordWrap(i + 1, 0, False)
            self.table.getCellFormatter().setWordWrap(i + 1, 1, False)
            self.table.getCellFormatter().setWordWrap(i + 1, 2, False)
            self.table.getFlexCellFormatter().setColSpan(i + 1, 2, 2)
            i = i + 1


    def selectRow(self, row):
        # When a row (other than the first one, which is used as a header) is
        # selected, display its associated MailItem.
        item = MailItems().getMailItem(self.startIndex + row)
        if item is None:
            return
#.........这里部分代码省略.........
开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:103,代码来源:MailList.py

示例7: JS

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
import buzz.js

JS('''
var mySound1 = new buzz.sound("http://10.0.10.95/media/finish.wav");
var mySound2 = new buzz.sound("http://10.0.10.95/media/race.wav");
''')

contestPosition = 0
candidatePosition = 0
confirm = 0
currObj = ""
review_path = []

contest = HorizontalPanel()
contest.setStyleName('words')
candidate = HorizontalPanel()
candidate.setStyleName('words')
selection = HorizontalPanel()
selection.setStyleName('words')
status = HorizontalPanel()
status.add(HTML('STATUS'))
status.setStyleName('words')

title = HorizontalPanel()
instructions = HorizontalPanel()

race = Race('', [], '', '')
  
          
def sendRace(srace):
开发者ID:simbara,项目名称:Voting,代码行数:32,代码来源:sampleBallot.py

示例8: onModuleLoad

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
class MovieRatings:
	def onModuleLoad(self):
        # Setup JSON RPC
		self.remote = DataService()

### Initialize member variables
		self.mainPanel = HorizontalPanel()
		self.rightPanel = VerticalPanel()
		self.moviesPanel = VerticalPanel()
		self.topRatedPanel = VerticalPanel()
		self.categoriesPanel = VerticalPanel()
        
		self.moviesFlexTable = FlexTable()
		self.topRatedMoviesFlexTable = FlexTable()
		self.topCategoryMoviesFlexTable = FlexTable()
        
		self.lessThanFiveLabel = Label('There are less than 5 movies. Add more movies!')
		self.moviesListLabel = Label('Movies List')
        
		self.addPanel = VerticalPanel()
		self.newMovieCategoryTextBox = TextBox()
		self.newMovieNameTextBox = TextBox()
		self.newMovieRatingListBox = ListBox(False)
		self.addMovieButton = Button('Add', self.addMovieButton_Click)
        
		self.movies = []
		self.topRatedMovies = []
		self.categories = {}
		
		self.MAX_RATING = 10
		
###	Add Movie Panel
		# Add ratings to list box
		for i in range(self.MAX_RATING + 1):
			self.newMovieRatingListBox.addItem(str(i))
		
		# Add label and textbox to horizontal panel
		self.labelPanel = HorizontalPanel()
		self.labelPanel.add(Label("Add a movie:"))
		self.categoryPanel = HorizontalPanel()
		self.categoryPanel.add(Label("Category: "))
		self.categoryPanel.add(self.newMovieCategoryTextBox)
		self.namePanel = HorizontalPanel()
		self.namePanel.add(Label("Movie Name: "))
		self.namePanel.add(self.newMovieNameTextBox)
		self.ratingPanel = HorizontalPanel()
		self.ratingPanel.add(Label("Movie Rating: "))
		self.ratingPanel.add(self.newMovieRatingListBox)

		self.labelPanel.addStyleName("addLabel")
		self.labelPanel.setSpacing(5)
		self.categoryPanel.addStyleName("addPanel")
		self.categoryPanel.setSpacing(5)
		self.namePanel.addStyleName("addPanel")
		self.namePanel.setSpacing(5)
		self.ratingPanel.addStyleName("addPanel")
		self.ratingPanel.setSpacing(5)
		self.newMovieCategoryTextBox.addStyleName("addPanel-input")
		self.newMovieNameTextBox.addStyleName("addPanel-input")
		self.newMovieRatingListBox.addStyleName("addPanel-input")
		
		self.addPanel.add(self.labelPanel)
		self.addPanel.add(self.categoryPanel)
		self.addPanel.add(self.namePanel)
		self.addPanel.add(self.ratingPanel)
		self.addPanel.add(self.addMovieButton)
		self.addPanel.addStyleName("addPanel")
		
		self.addMovieButton.addStyleName('addButton')
		self.addPanel.add(self.addMovieButton)
		self.addPanel.addStyleName('addPanel')
		
###	Movies table
		self.moviesFlexTable.setText(0, 1, "Category")
		self.moviesFlexTable.setText(0, 2, "Title")
		self.moviesFlexTable.setText(0, 3, "Rating")

		self.moviesFlexTable.addStyleName("movieList")
		self.moviesFlexTable.getRowFormatter().addStyleName(0, "listHeader")
		self.moviesFlexTable.setCellPadding(6)
		self.moviesFlexTable.getCellFormatter().setStyleName(0, 1, "listHeaderColumn")
		self.moviesFlexTable.getCellFormatter().setStyleName(0, 2, "listHeaderColumn")
		self.moviesListLabel.addStyleName("listLabel")

		self.moviesPanel.add(self.moviesListLabel)
		self.moviesPanel.add(self.moviesFlexTable)
		self.moviesPanel.setStyleName("moviesPanel")
		
###	Top rated movies table
		self.topRatedMoviesFlexTable.setText(0, 0, "Category")
		self.topRatedMoviesFlexTable.setText(0, 1, "Title")
		self.topRatedMoviesFlexTable.setText(0, 2, "Rating")

		self.topRatedMoviesFlexTable.addStyleName("topMoviesList")
		self.topRatedMoviesFlexTable.getRowFormatter().addStyleName(0, "listHeader")
		self.topRatedMoviesFlexTable.setCellPadding(6)
		self.topRatedMoviesFlexTable.getCellFormatter().setStyleName(0, 0, "listHeaderColumn")
		self.topRatedMoviesFlexTable.getCellFormatter().setStyleName(0, 1, "listHeaderColumn")

		self.topRatedLabel = Label("Top 5 Rated Movies")
#.........这里部分代码省略.........
开发者ID:FloorLamp,项目名称:CS3300-HW4,代码行数:103,代码来源:MovieRatings.py

示例9: HorizontalPanel

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
from __pyjamas__ import JS
from fysom import Fysom
from ballotTree import Race
from pyjamas.ui import KeyboardListener
from pyjamas.ui.HorizontalPanel import HorizontalPanel
from pyjamas.ui.HTML import HTML

contestPosition = 0
candidatePosition = 0
confirm = 0
currObj = ""

contest = HorizontalPanel()
contest.setStyleName("words")
candidate = HorizontalPanel()
candidate.setStyleName("words")
selection = HorizontalPanel()
selection.setStyleName("words")
status = HorizontalPanel()
status.add(HTML("STATUS"))
status.setStyleName("words")

title = HorizontalPanel()
instructions = HorizontalPanel()

#

JS(
    """
var mainSnd = new Audio();
var snd1 = new Audio();
开发者ID:simbara,项目名称:Voting,代码行数:33,代码来源:sampleBallot2.py

示例10: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setStyleName [as 别名]
class pjBallot:
    
    def __init__(self):
        self.mainPanel = VerticalPanel()
        self.contest = HorizontalPanel()
        self.contest.setStyleName('words')
        self.selection = HorizontalPanel()
        self.selection.setStyleName('words')
        self.button = Button('test', self.test)
        self.status = Label('hi')
        self.x = 1
    
    def test(self):
        self.button.setText("No, really click me!")
#        Window.alert("Hello, AJAAAX!")
        self.contest.add(HTML('yay'))

    def nextContest(self):
        self.x += 1
        self.contest.clear()
        self.contest.add(HTML('<b /> Contest: %d' % self.x))

    def nextSelection(self):
        self.x += 1
        self.selection.clear()
        self.selection.add(HTML('<b /> Selection: %d' % self.x))
    
    def onKeyDown(self, sender, keycode, modifiers):
        pass

    def onKeyUp(self, sender, keycode, modifiers):
        pass

    def onKeyPress(self, sender, keycode, modifiers):
        DOM.eventPreventDefault(DOM.eventGetCurrentEvent()) #not needed
        if keycode == KeyboardListener.KEY_UP:
            self.nextContest()
        if keycode == KeyboardListener.KEY_DOWN:
            self.nextContest()
        if keycode == KeyboardListener.KEY_LEFT:
            self.nextSelection()
        if keycode == KeyboardListener.KEY_RIGHT:
            self.nextSelection()


    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)
        
#        encoded_object = '[{"__jsonclass__": "Candidate.Candidate", "name": "Barack Obama"}]'
##        test = json2.loads(encoded_object)
##        self.mainPanel.add(HTML("%s" % test))#json.loads(encoded_object)))#, object_hook=self.dict_to_object)))
#        foo = '["foo", {"bar":["baz", null, 1.0, 2]}]'
#        bar = loads(foo, object_hook=tester)
#        self.mainPanel.add(HTML(bar))

 
    def dict_to_object(self,d):
        Window.alert("Hello, AJAAAX!")
        self.mainPanel.add(HTML('whatevs: %s' % 12))
        if '__class__' in d:
            # import pdb
            # pdb.set_trace()
            class_name = d.pop('__class__')
            module_name = d.pop('__module__')
            module = __import__(module_name)
            print 'MODULE:', module
            class_ = getattr(module.ballotTree, class_name) #because module was just audioBallot
            print 'CLASS:', class_
            args = dict( (key.encode('ascii'), value) for key, value in d.items())
            print 'INSTANCE ARGS:', args
            inst = class_(**args)
        else:
            inst = d
        return inst       
    

    
    def onRemoteResponse(self, response, request_info): 
        race = response  
        name = race.works
        self.mainPanel.add(HTML('pleasework %s' % name))
#        self.mainPanel.add(HTML('pleasework2 %s' % JSONResponseTextHandler(response)))
#        test = JSONResponseTextHandler(response)
#        test.request
#        self.mainPanel.add(HTML('pleasework3 %s' % test.name))
#.........这里部分代码省略.........
开发者ID:simbara,项目名称:Old-Voting,代码行数:103,代码来源:pjBallot.py


注:本文中的pyjamas.ui.HorizontalPanel.HorizontalPanel.setStyleName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。