本文整理汇总了Python中pyjamas.ui.HorizontalPanel.HorizontalPanel.setBorderWidth方法的典型用法代码示例。如果您正苦于以下问题:Python HorizontalPanel.setBorderWidth方法的具体用法?Python HorizontalPanel.setBorderWidth怎么用?Python HorizontalPanel.setBorderWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HorizontalPanel.HorizontalPanel
的用法示例。
在下文中一共展示了HorizontalPanel.setBorderWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setBorderWidth [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)
示例2: onModuleLoad
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setBorderWidth [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(" ")
self.midpanel = MidPanel(self)
self.cp2 = CollapserPanel(self)
self.cp2.setWidget(self.midpanel)
self.cp2.setHTML(" ")
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(" ")
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)
#.........这里部分代码省略.........
示例3: Trees
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setBorderWidth [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"])
#.........这里部分代码省略.........
示例4: RichTextEditor
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import setBorderWidth [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
#.........这里部分代码省略.........