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


Python Button.addStyleName方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import addStyleName [as 别名]
    def __init__(self, *args, **kwargs):
        super(LayersPanel, self).__init__(*args, **kwargs)
        navbar = NavigationBar()
        navbar.add(HTML('<div class="brand">Layers</div>'))

        b = Button("Edit", StyleName="btn")
        b.addStyleName("btn-inverse")
        b.addStyleName("pull-right")
        navbar.add(b)

        self.add(navbar)

        self._tree = Tree()
        self.add(self._tree)
开发者ID:rjw57,项目名称:foldbeam,代码行数:16,代码来源:Sidebar.py

示例2: __init__

# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import addStyleName [as 别名]
 def __init__(self,  **kwargs):
     FlexTable.__init__(self, **kwargs)
     FocusHandler.__init__(self)
     self.buttons = {}
     fmt = self.getFlexCellFormatter()
     for i, row in enumerate(rows):
         for j, letter in enumerate(row):
             if letter == ' ':
                 l = '&nbsp;'
             else:
                 l = letter
             button = Button(l, self, StyleName="kbdbutton")
             self.buttons[letter] = button
             self.setWidget(i, j, button)
             if letter == ' ':
                 fmt.setColSpan(i, j, 5)
                 button.addStyleName("kbdbuttonspace")
开发者ID:davelab6,项目名称:telaro,代码行数:19,代码来源:keyboard.py

示例3: onModuleLoad

# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import addStyleName [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

示例4: EventLinkPopup

# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import addStyleName [as 别名]
class EventLinkPopup(PopupPanel):

    def __init__(self, editor):
        PopupPanel.__init__(self, glass=True)

        self.m_origAnchorStart = None
        self.m_origAnchorEnd = None
        self.m_origTargetText = ""
        self.m_editor = editor

        vpanel = VerticalPanel()
        vpanel.setWidth("350px")

        self.m_webPageText = TextBox()
        self.m_webPageText.setText("http:#")
        self.m_webPageText.setWidth("320px")

        vpanel.add(self.m_webPageText)

        lbl = Label("Display:")

        self.m_targetText = TextBox()
        self.m_targetText.setWidth("100%")

        lpanel = HorizontalPanel()
        lpanel.add(lbl)
        lpanel.add(self.m_targetText)

        vpanel.add(lpanel)

        self.m_fillOutCB = CheckBox("Change entire link")
        self.m_fillOutCB.setVisible(False)
        self.m_fillOutCB.addClickListener(self)
        vpanel.add(self.m_fillOutCB)

        self.m_okBut = Button("Ok", self)
        self.m_okBut.addStyleName("float-left")

        self.m_cancelBut = Button("Cancel", self)
        self.m_cancelBut.addStyleName("float-left")

        hpanel = HorizontalPanel()
        hpanel.add(self.m_okBut)
        hpanel.add(self.m_cancelBut)

        vpanel.add(hpanel)

        self.add(vpanel)
        self.setStyleName("gwt-DialogBox")

    def refresh(self):
        try:
            self.m_editor.getSelection()
            self.m_range = self.m_editor.getRange()
            if self.m_range is None:
                return False
            else:
                self.m_selTexts = self.m_range.getSelectedTextElements()
                if self.m_selTexts is None:
                    return False
                else:
                    self.m_origTargetText = self.m_range.getText()
                    self.m_targetText.setText(self.m_origTargetText)

                    anchor = self.getAnchor(self.m_selTexts)
                    if anchor is not None:
                        href = anchor.getHref().strip()
                        if href:
                            self.m_webPageText.setText(href)

                        self.m_origAnchorStart = self.getAnchorLimit(
                                self.m_range.getStartPoint().getTextNode(),
                                anchor, False)
                        self.m_origAnchorEnd = self.getAnchorLimit(
                                self.m_range.getStartPoint().getTextNode(),
                                anchor, True)

                        if self.m_range.getStartPoint().equals(self.m_origAnchorStart)  and  self.m_range.getStartPoint().equals(self.m_origAnchorEnd):
                            self.m_origAnchorStart = None
                            self.m_origAnchorEnd = None

                        else:
                            self.m_fillOutCB.setVisible(True)
                            self.m_fillOutCB.setValue(True)

                            self.m_origTargetText = self.fetchStringFromTexts(
                                self.m_origAnchorStart, self.m_origAnchorEnd)
                            self.m_targetText.setText(self.m_origTargetText)





        except:
            print "exception"
            traceback.print_exc()
            return False

        return True

#.........这里部分代码省略.........
开发者ID:Afey,项目名称:pyjs,代码行数:103,代码来源:RichTextToolbar.py


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