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


Python HorizontalPanel.setWidth方法代码示例

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


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

示例1: __init__

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

        panel = HorizontalPanel()
        panel.setBorderWidth(1)

        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellWidth(part1, "10%")
        panel.setCellWidth(part2, "70%")
        panel.setCellWidth(part3, "10%")
        panel.setCellWidth(part4, "10%")

        panel.setCellVerticalAlignment(part3, HasAlignment.ALIGN_BOTTOM)

        panel.setWidth("100%")
        panel.setHeight("200px")

        self.add(panel)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:32,代码来源:horizontalPanel.py

示例2: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
	def __init__( self ) :
		numberOfLoopsPanel=HorizontalPanel()
		numberOfLoopsPanel.add( HTML("Maximum number of loops") )
		self.maximumNumberOfLoops=TextBox()
		self.maximumNumberOfLoops.setText(10)
		numberOfLoopsPanel.add( self.maximumNumberOfLoops )
		numberOfLoopsPanel.setCellHorizontalAlignment( self.maximumNumberOfLoops, HasHorizontalAlignment.ALIGN_RIGHT )
		numberOfLoopsPanel.setWidth("100%")
		
		aimPointPanel=HorizontalPanel()
		aimPointPanel.add( HTML("Aim point") )
		self.aimPoint=TextBox()
		self.aimPoint.setText(127)
		aimPointPanel.add( self.aimPoint )
		aimPointPanel.setCellHorizontalAlignment( self.aimPoint, HasHorizontalAlignment.ALIGN_RIGHT )
		aimPointPanel.setWidth("100%")

		self.start=Button("Start")
		
		self.echo=HTML("Initiating...")
		
		self.mainPanel = VerticalPanel()
		self.mainPanel.add( numberOfLoopsPanel )
		self.mainPanel.add( aimPointPanel )
		self.mainPanel.add( self.start )
		self.mainPanel.add( self.echo )
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:28,代码来源:CalibrateChannelTrimsPanel.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
  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)
开发者ID:victormatheus,项目名称:cbir_pyjamas,代码行数:45,代码来源:cbir.py

示例4: createRegisterPanel

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
	def createRegisterPanel( self, registerNames ) :
		"""
		Creates panels and buttons for everything given in registerNames, and returns the main panel.
		"""
		flowPanel=FlowPanel()
		for buttonName in registerNames :
			newPanel=HorizontalPanel()
			label=Label(buttonName)
			newPanel.add( label )
			newTextBox=TextBox()
			newTextBox.setEnabled(False)
			newTextBox.setWidth(80)
			statusBox=TextBox()
			statusBox.setEnabled(False)
			statusBox.setWidth(30)
			newPanel.add(newTextBox)
			newPanel.add(statusBox)
			newPanel.setCellHorizontalAlignment( newTextBox, HasHorizontalAlignment.ALIGN_RIGHT )
			newPanel.setCellHorizontalAlignment( statusBox, HasHorizontalAlignment.ALIGN_RIGHT )
			newPanel.setCellWidth( statusBox, "20px" )
			newPanel.setWidth("100%")
			#newPanel.setStyleName("areaStyle");
			#newPanel.setBorderWidth(5);
			
			newTextBox.setText("select chip...")
			newTextBox.addChangeListener(self)
			newTextBox.setTitle(buttonName) # This isn't displayed, but it's useful to have stored
			
			self.i2cValueEntries[buttonName]=newTextBox	
			
			self.statusValueEntries[buttonName]=statusBox
			statusBox.setTitle(buttonName)
			statusBox.setText("...")
			
			flowPanel.add(newPanel)


		return flowPanel
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:40,代码来源:I2CPanel.py

示例5: MailList

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

示例6: onModuleLoad

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
    def onModuleLoad(self):
        # Window.setTitle("CBC Test Stand")
        StyleSheetCssFile("styleSheet.css")

        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.status = Label()

        # This is the remote service
        self.I2CPanel = I2CPanel()
        self.SCurveRunPanel = SCurveRunPanel()
        self.OccupancyCheckPanel = OccupancyCheckPanel()
        self.CalibrateChannelTrimsPanel = CalibrateChannelTrimsPanel()

        # mainPanel will have all of the working stuff in it
        self.mainPanel = DockPanel()
        # self.mainPanel.setSpacing(10)
        titleBar = HorizontalPanel()
        titleBar.add(HTML(r"CBC Test Stand (v1.1)", StyleName="titleStyle"))
        self.stopTakingDataButton = Button("Stop taking data")
        self.stopTakingDataButton.addClickListener(self)
        self.dataTakingPercentage = HTML("0%")
        self.dataTakingStatus = HTML("Initiating...")
        titleBar.add(self.dataTakingPercentage)
        titleBar.add(self.dataTakingStatus)
        titleBar.add(self.stopTakingDataButton)
        titleBar.setCellHorizontalAlignment(self.dataTakingStatus, HasHorizontalAlignment.ALIGN_RIGHT)
        titleBar.setCellHorizontalAlignment(self.dataTakingPercentage, HasHorizontalAlignment.ALIGN_RIGHT)
        titleBar.setCellHorizontalAlignment(self.stopTakingDataButton, HasHorizontalAlignment.ALIGN_RIGHT)
        titleBar.setWidth("100%")
        self.mainPanel.add(titleBar, DockPanel.NORTH)
        selectionPanel = VerticalPanel()

        # Register to get updates about the status of data taking, so that
        # I can update the information in the title bar
        self.dataRunManager = DataRunManager.instance()
        self.dataRunManager.registerEventHandler(self)

        self.activePanelButton = None
        self.activePanel = None

        self.registersButton = Label("I2C Registers", StyleName="areaStyle")
        self.occupanciesButton = Label("Test Occupancies", StyleName="areaStyle")
        self.scurveButton = Label("S-Curve Run", StyleName="areaStyle")
        self.calibrateTrimsButton = Label("Calibrate Trims", StyleName="areaStyle")

        self.registersButton.addClickListener(self)
        self.occupanciesButton.addClickListener(self)
        self.scurveButton.addClickListener(self)
        self.calibrateTrimsButton.addClickListener(self)

        selectionPanel.add(self.registersButton)
        selectionPanel.add(self.occupanciesButton)
        selectionPanel.add(self.scurveButton)
        selectionPanel.add(self.calibrateTrimsButton)

        self.mainPanel.add(selectionPanel, DockPanel.WEST)

        self.mainPanel.add(self.status, DockPanel.SOUTH)
        RootPanel().add(self.mainPanel)

        self.setNewMainPanel(self.registersButton)
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:65,代码来源:index.py

示例7: onModuleLoad

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
class PageIndex:
    def onModuleLoad(self):
        # JSON RPC response containers
        self.facebook_user = {}
        self.app_info = {}
        self.wl_books = []
        self.sl_books = []
        self.events = []

        # setup JSON RPC
        self.remote = DataService()

        # make JSON RPC calls
        self.remote.get_app_info(self, "index")
        self.remote.get_wish_list(self)
        self.remote.get_sell_list(self)

        self.remote.get_events(self, 10)

        # panels
        self.main_panel = HorizontalPanel()
        self.feed_panel = VerticalPanel()
        self.list_panel = VerticalPanel()

        self.feed_panel.addStyleName("feed_panel")
        self.list_panel.addStyleName("list_panel")

        # labels
        self.html_feed_title = HTML("<h1>Recent Activity</h1>")
        self.html_wish_title = HTML("<h1>Your Wishlist</h1>")
        self.html_sell_title = HTML("<h1>Your Selllist</h1>")

        # user lists
        self.wish_list = UserList("wish", self)
        self.sell_list = UserList("sell", self)

        self.wish_list.addStyleName("userlist")
        self.sell_list.addStyleName("userlist")

        self.feed_panel.add(self.html_feed_title)

        self.list_panel.add(self.html_wish_title)
        self.list_panel.add(self.wish_list)

        self.list_panel.add(HTML("<br />"))
        self.list_panel.add(self.html_sell_title)
        self.list_panel.add(self.sell_list)

        # add everything together
        self.main_panel.add(self.feed_panel)
        self.main_panel.add(self.list_panel)
        self.main_panel.setWidth("100%")

        RootPanel("page_index").add(self.main_panel)

        show_events = self.show_events
        class EventTimer(Timer):
            def run(self):
                show_events()
        et = EventTimer()
        self.show_events()
        et.scheduleRepeating(5000)

    def populate_book_lists(self):
        """ check the JSON RPC containers and fill the UserLists if
            it finds them to be non-empty
        """
        for b in self.wl_books:
            Window.alert(str(b))
            self.wish_list.add_book(b)
            
        for b in self.sl_books:
            self.sell_list.add_book(b)
        return True

    def show_events(self):
        """ create events on the recent activity feed 
        """
        for e in self.events:
            self.add_event(e)
        self.events = []
	
    def add_event(self, event):
        """ add an event to the recent activity feed
        """
        event_panel = HorizontalPanel()
        mid_panel = VerticalPanel()
        book_panel = HorizontalPanel()

        # profile picture
        pic_url = "https://graph.facebook.com/" + event['fbid'] + "/picture"
        pic_html = HTML("<img src=\"%s\" />" % pic_url)

        # event string
        event_html = HTML("<span style=\"font-weight: bold\">%s</span>" % event['string'])
        url = self.app_info['url'] + "book?asin=" + event['book']['asin']

        cutoff = 40
        # book thumbnail
        img_url = event['book']['thumbnail']
#.........这里部分代码省略.........
开发者ID:cy245,项目名称:TextbookConnect,代码行数:103,代码来源:page_index.py

示例8: Button

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
    resdict = resgen_core.processconf(inputArea.getText())
    hData = resgen_core.processhorz(resdict, hTemplate, footdict)
    outputArea.setText(hData)

if __name__ == '__main__':
    b = Button("Convert", convert)

    p = HorizontalPanel()
    p.add(inputArea)
    p.add(outputArea)
   
    q = VerticalPanel()
    q.setStyleName("panel")
    q.add(b)
    q.add(p)

   
    q.setHeight("100%")
    q.setWidth("100%")
    p.setHeight("80%")
    p.setWidth("100%")
    inputArea.setHeight("100%")
    inputArea.setWidth("100%")
    outputArea.setHeight("100%")
    outputArea.setWidth("100%")

    inputArea.setText(confDefault)

    RootPanel().add(q)

开发者ID:johnpeck,项目名称:resgen,代码行数:31,代码来源:resgen_web.py

示例9: onModuleLoad

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
class InfoDirectory:

    def onModuleLoad(self):

        self.remote = InfoServicePython()

        self.tree_width = 200

        self.tp = HorizontalPanel()
        self.tp.setWidth("%dpx" % (self.tree_width))
        self.treeview = Trees()
        self.treeview.fTree.addTreeListener(self)
        self.sp = ScrollPanel()
        self.tp.add(self.treeview)
        self.sp.add(self.tp)
        self.sp.setHeight("100%")

        self.horzpanel1 = HorizontalPanel()
        self.horzpanel1.setSize("100%", "100%")
        self.horzpanel1.setBorderWidth(1)
        self.horzpanel1.setSpacing("10px")

        self.rp = RightPanel()
        self.rps = ScrollPanel()
        self.rps.add(self.rp)
        self.rps.setWidth("100%")
        self.rp.setWidth("100%")

        self.cp1 = CollapserPanel(self)
        self.cp1.setWidget(self.sp)
        self.cp1.setHTML("&nbsp;")


        self.midpanel = MidPanel(self)
        self.cp2 = CollapserPanel(self)
        self.cp2.setWidget(self.midpanel)
        self.cp2.setHTML("&nbsp;")

        self.horzpanel1.add(self.cp1)
        self.horzpanel1.add(self.cp2)
        self.horzpanel1.add(self.rps)

        self.cp1.setInitialWidth("%dpx" % self.tree_width)
        self.cp2.setInitialWidth("200px")

        RootPanel().add(self.horzpanel1)

        width = Window.getClientWidth()
        height = Window.getClientHeight()

        self.onWindowResized(width, height)
        Window.addWindowResizeListener(self)
  
    def setCollapserWidth(self, widget, width):
        self.horzpanel1.setCellWidth(widget, width)

    def onWindowResized(self, width, height):
        #self.hp.setWidth("%dpx" % (width - self.tree_width))
        #self.hp.setHeight("%dpx" % (height - 20))
        self.cp1.setHeight("%dpx" % (height - 30))
        self.cp2.setHeight("%dpx" % (height - 30))
        self.rps.setHeight("%dpx" % (height - 30))
        self.horzpanel1.setHeight("%dpx" % (height - 20))

    def onTreeItemStateChanged(self, item):
        if item.isSelected():
            self.onTreeItemSelected(item)

    def onTreeItemSelected(self, item):

        obj = item.getUserObject()
        if len(obj.children) != 0:
            self.clear_mid_panel()
            return

        self.remote.get_midpanel_data(obj.root + "/" + obj.text, self)
        self.cp2.setHTML(obj.text)
        self.clear_right_panel()

    def clear_right_panel(self):
        self.horzpanel1.remove(2)
        self.horzpanel1.insert(HTML(""), 2)
        self.rp.setTitle("&nbsp;")

    def clear_mid_panel(self):
        self.clear_right_panel()
        #self.horzpanel2.setLeftWidget(HTML(""))

    def set_mid_panel(self, response):

        self.midpanel.set_items(response)

        self.cp2.setWidget(self.midpanel)

    def select_right_grid(self, location, name):
        self.horzpanel1.remove(2)
        self.horzpanel1.insert(self.rps, 2)
        self.rp.setTitle(name)
        self.remote.get_rightpanel_datanames(location, self)

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

示例10: RichTextToolbar

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
class RichTextToolbar(Composite, ClickHandler, ChangeHandler):

    fontSizesConstants = [
        RichTextAreaConsts.XX_SMALL, RichTextAreaConsts.X_SMALL,
        RichTextAreaConsts.SMALL, RichTextAreaConsts.MEDIUM,
        RichTextAreaConsts.LARGE, RichTextAreaConsts.X_LARGE,
        RichTextAreaConsts.XX_LARGE
    ]

    """*
    * Creates a toolbar that drives the given rich text area.
    *
    * @param richText the rich text area to be controlled
    """
    def __init__(self, richText, _parent, **kwargs):

        self.isInText = False
        self.lastText = ""
        self.trigger = False
        self.lastRange = None
        self._parent = _parent

        # Timer for trying real time selection change stuff
        self.timerRange = None
        self.selTimer = Timer(notify=self.run)

        self.outer = VerticalPanel()
        self.topPanel = HorizontalPanel(BorderWidth=1)
        self.bottomPanel = HorizontalPanel()

        self.richText = richText
        self.basic = richText.getBasicFormatter()
        self.extended = richText.getExtendedFormatter()

        self.outer.add(self.topPanel)
        self.outer.add(self.bottomPanel)
        self.topPanel.setWidth("100%")
        self.topPanel.setHeight("20px")
        self.bottomPanel.setWidth("100%")

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-RichTextToolbar")

        Composite.__init__(self, self.outer, **kwargs)
        ClickHandler.__init__(self)
        ChangeHandler.__init__(self)

        if self.basic is not None:
            self.bold = self.createToggleButton(Images.bold,
                                            "bold")
            self.italic = self.createToggleButton(Images.italic,
                                            "italic")
            self.underline = self.createToggleButton(Images.underline,
                                            "underline")
            self.subscript = self.createToggleButton(Images.subscript,
                                            "subscript")
            self.superscript = self.createToggleButton(Images.superscript,
                                            "superscript")
            self.justifyLeft = self.createPushButton(Images.justifyLeft,
                                            "justify left")
            self.justifyCenter = self.createPushButton(Images.justifyCenter,
                                            "justify centre")
            self.justifyRight = self.createPushButton(Images.justifyRight,
                                            "justify right")
            self.topPanel.add(self.bold)
            self.topPanel.add(self.italic)
            self.topPanel.add(self.underline)
            self.topPanel.add(self.subscript)
            self.topPanel.add(self.superscript)
            self.topPanel.add(self.justifyLeft)
            self.topPanel.add(self.justifyCenter)
            self.topPanel.add(self.justifyRight)

        if self.extended is not None:
            self.strikethrough = self.createToggleButton(Images.strikeThrough,
                                            "strikethrough")
            self.indent = self.createPushButton(Images.indent,
                                            "indent")
            self.outdent = self.createPushButton(Images.outdent,
                                            "outdent")
            self.hr = self.createPushButton(Images.hr,
                                            "hr")
            self.ol = self.createPushButton(Images.ol,
                                            "ordered list")
            self.ul = self.createPushButton(Images.ul,
                                            "unordered list")
            self.insertImage = self.createPushButton(Images.insertImage,
                                            "insert image")
            self.createLink = self.createPushButton(Images.createLink,
                                            "create link")
            self.removeLink = self.createPushButton(Images.removeLink,
                                            "remove link")
            self.removeFormat = self.createPushButton(Images.removeFormat,
                                            "remove formatting")

            self.topPanel.add(self.strikethrough)
            self.topPanel.add(self.indent)
            self.topPanel.add(self.outdent)
            self.topPanel.add(self.hr)
            self.topPanel.add(self.ol)
            self.topPanel.add(self.ul)
#.........这里部分代码省略.........
开发者ID:Afey,项目名称:pyjs,代码行数:103,代码来源:RichTextToolbar.py

示例11: Trees

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
class Trees(Sink):
    pathdict = {}
    reduceFiles = None
    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.prPanel = VerticalPanel(Size=("50%", ""))
        self.treePanel = HorizontalPanel(Size=("50%", "100%"))
        self.treePanel.add(self.fTree)
        dock.add(self.treePanel, DockPanel.WEST)
        
        self.treePanel.setBorderWidth(1)
        self.treePanel.setWidth("100%")
        self.prPanel.setBorderWidth(1)
        self.prPanel.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.prPanel.add(self.reduceCLPanel)
        self.prPanel.add(self.reduceFilesPanel)
        self.prPanel.add(self.recipeListPanel)
        self.prPanel.add(self.runReduceButton)
        self.prPanel.add(self.adInfo)
       
        
        dock.add(self.prPanel,DockPanel.EAST)
        
        dock.setCellWidth(self.treePanel, "50%")
        dock.setCellWidth(self.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)

    def onTreeItemSelected(self, item):
        pathdict = self.pathdict
        
        tfile = item.getText()
        #check if already in

        for i in range(0, self.reduceFiles.getItemCount()):
            fname = self.reduceFiles.getItemText(i)
            if fname == tfile:
                return
        self.reduceFiles.addItem(tfile)
        self.updateReduceCL()
        
        filename = tfile
        if filename in pathdict:
            if pathdict[filename]["filetype"] == "fileEntry":
                HTTPRequest().asyncGet("adinfo?filename=%s" % self.pathdict[item.getText()]["path"], 
                               ADInfoLoader(self),
                              )
            else:
                self.adInfo.setHTML("""
                    <b style="font-size:200%%">%s</b>""" % pathdict[filename]["filetype"])
#.........这里部分代码省略.........
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:103,代码来源:RecipeSystemIFACE.py

示例12: onModuleLoad

# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setWidth [as 别名]
class PageBookComments:
    def onModuleLoad(self):
        # parse get data
        self.location = Window.getLocation().getHref()
        self.get_data = {}
        self.tmp = self.location.split('?')
        self.tmp = self.tmp[len(self.tmp) - 1].split("&")
        for e in self.tmp:
            get_var = e.split("=")
            if len(get_var) == 2:
                self.get_data[get_var[0]] = get_var[1]

        # JSON RPC response holders
        self.facebook_user = {}
        self.app_info = {}
        self.sellers = []
        self.book = {}
        self.has_book = "none"
        
        # setup JSON RPC
        self.remote = DataService()

        self.remote.get_facebook_user(self)
        self.remote.get_app_info(self, "book_detail")
        if "asin" in self.get_data:
            self.remote.get_book_details(self, self.get_data["asin"])
            self.remote.get_sellers(self, self.get_data["asin"])
            self.remote.user_has_book(self, self.get_data["asin"])

        # create panels
        self.main_panel = HorizontalPanel()
        self.info_panel = VerticalPanel()
        self.sell_btn_panel = VerticalPanel()
        self.wish_btn_panel = VerticalPanel()
        self.seller_panel = VerticalPanel()
        self.add_comment_panel = VerticalPanel()

        # images
        self.img_book_cover = Image()

        # html labels
        self.html_book_title = HTML()
        self.html_book_author = HTML()
        self.html_book_isbn10 = HTML()
        self.html_book_publisher = HTML()
        self.html_book_publish_date = HTML()
        self.html_book_edition = HTML()
        self.html_book_binding = HTML()

        self.html_btn_sell = HTML()
        self.html_btn_wish = HTML()
        
        self.html_seller_title = HTML()

        # check for no get data!
        if "asin" not in self.get_data:
            self.html_book_title.setHTML("<h1>Book not found!</h1>\n<p>The book you are looking for does not exist.</p>")
            self.info_panel.setWidth("100%")
            self.main_panel.setWidth("100%")
            self.info_panel.add(self.html_book_title)
            self.main_panel.add(self.info_panel)
            RootPanel("page_book_comments").add(self.main_panel)
            return

        # add to sellers panel
        self.seller_panel.add(self.html_seller_title)
        self.seller_panel.addStyleName("comments")

        self.info_panel.add(self.html_book_title)
        self.info_panel.add(self.html_book_author)
        self.info_panel.add(self.html_book_isbn10)
        self.info_panel.add(self.html_book_publisher)
        self.info_panel.add(self.html_book_publish_date)
        self.info_panel.add(self.html_book_edition)
        self.info_panel.add(self.html_book_binding)
        self.info_panel.add(self.add_comment_panel)
        self.info_panel.add(self.seller_panel)
        self.info_panel.addStyleName("info_panel")
        
        self.main_panel.add(self.info_panel)
        self.main_panel.add(self.img_book_cover)
        
        RootPanel("page_book_comments").add(self.main_panel)
        
        # spin until book info get here
        class SpinTimer(Timer):
            def __init__(self, max_tries = 10, interval = 500):
                Timer.__init__(self)
                self.interval = interval
                self.max_tries = max_tries
                self.tries = 0
                self.func = func
                self.params = params
                self.scheduleRepeating(self.interval)

            def run(self):
                self.tries += 1

                if self.tries >= self.max_tries:
                    Window.alert("It looks like there's a connection problem. We're sorry about the inconvenience. Please try again later.")
#.........这里部分代码省略.........
开发者ID:cy245,项目名称:TextbookConnect,代码行数:103,代码来源:page_book_comments.py

示例13: RichTextEditor

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


    def run(self):
        try:
            self.getSelection()
            rng = Selection.getRange()
            if (self.m_timerRange is None)  or  (not self.m_timerRange.equals(rng)):
                self.onSelectionChange(rng)
                self.m_timerRange = rng

        except:
            GWT.log("Error in timer selection", ex)

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

        self.m_isInText = False
        self.m_lastText = ""
        self.trigger = False
        self.m_lastRange = None

        # Timer for trying real time selection change stuff
        self.m_timerRange = None
        self.m_selTimer = Timer()

        self.m_mainPanel = DockPanel()
        self.m_toolbarPanel = HorizontalPanel()
        self.m_toolbarPanel.setWidth("100%")
        self.m_toolbarPanel.setHeight("25px")
        self.m_toolbarPanel.setBorderWidth(1)
        self.m_toolbarPanel.addStyleName("timeline-RichTextToolbar")

        self.m_textW = RichTextArea()
        self.m_textW.addClickListener(self)
        self.m_textW.addKeyboardListener(self)
        self.m_textW.addFocusListener(self)
        self.m_textW.addMouseListener(self)
        # According to gwt doc, these do need to be set because this is a frame
        self.m_textW.setHeight("100%")
        self.m_textW.setWidth("100%")

        # Add buttons
        self.m_formatter = self.getFormatter()

        self.m_boldW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.bold_icon, "Bold")
        self.m_italicW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.italics_icon, "Italic")
        self.m_underlineW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.underline_icon, "Underline")
        self.m_subscriptW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.subscript_icon, "Subscript")
        self.m_superscriptW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.superscript_icon, "Superscript")
        self.m_strikethroughW = self.addToggleButton(self.m_toolbarPanel,
                                    Icons.strikethrough_icon, "Strikethrough")

        self.m_indentW = self.addPushButton(self.m_toolbarPanel,
                                    Icons.indentmore_icon, "Indent Right")
        self.m_outdentW = self.addPushButton(self.m_toolbarPanel,
                                    Icons.indentless_icon, "Indent Left")
        self.m_justifyLeftW = self.addPushButton(self.m_toolbarPanel,
                                    Icons.justifyleft_icon, "Justify Left")
        self.m_justifyCenterW = self.addPushButton(self.m_toolbarPanel,
                                    Icons.justifycenter_icon, "Justify Center")
        self.m_justifyRightW = self.addPushButton(self.m_toolbarPanel,
                                    Icons.justifyright_icon, "Justify Right")
        self.m_hrW = self.addPushButton(self.m_toolbarPanel,
                                Icons.horizontalrule_icon, "Horizontal Rule")
        self.m_olW = self.addPushButton(self.m_toolbarPanel,
                                Icons.numberedlist_icon, "Numbered List")
        self.m_ulW = self.addPushButton(self.m_toolbarPanel, Icons.list_icon, "List")
        self.m_newLinkW = self.addPushButton(self.m_toolbarPanel,
                                Icons.link_icon, "Link Document")
        self.m_removeFormatW = self.addPushButton(self.m_toolbarPanel,
                                Icons.noformat_icon, "No Format")

        self.m_mainPanel.add(self.m_toolbarPanel, DockPanel.NORTH)
        self.m_mainPanel.add(self.m_textW, DockPanel.CENTER)

        self.initWidget(self.m_mainPanel)
        self.sinkEvents(Event.ONCLICK)

    def getFormatter(self):
        return self.m_textW.getExtendedFormatter()

    def getRichTextArea(self):
        return self.m_textW

    def addPushButton(self, panel, imagep, tip):
        img = Image(imagep)
        img.setWidth("20px")
        img.setHeight("20px")

        pb = PushButton(img)
        self.addAnyButton(panel, pb, tip)
        return pb


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


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