本文整理汇总了Python中pyjamas.ui.VerticalPanel.VerticalPanel.setHorizontalAlignment方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.setHorizontalAlignment方法的具体用法?Python VerticalPanel.setHorizontalAlignment怎么用?Python VerticalPanel.setHorizontalAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.setHorizontalAlignment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Dashboard
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
class Dashboard(Composite):
def __init__(self):
Composite.__init__(self)
self.outer = VerticalPanel()
self.outer.setSpacing("20px")
self.outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER)
self.display_panel = DisplayPanel()
self.screen = Screen()
self.screen.base = self
self.screen.display_panel = self.display_panel
self.control_panel = ControlPanel()
self.control_panel.base = self
self.initWidget(self.outer)
self.outer.add(self.display_panel)
self.outer.add(self.screen)
self.outer.add(self.control_panel)
self.initDashboard()
def initDashboard(self):
self.screen.resize(4,4)
self.screen.shuffle()
def incrCount(self):
self.display_panel.incrCount()
示例2: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
def __init__(self):
Sink.__init__(self)
self.curImage=0
self.image=Image()
self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]
for i in range(len(self.sImages)):
self.sImages[i]=self.baseURL() + self.sImages[i]
self.image.addLoadListener(self)
self.prevButton.addClickListener(self)
self.nextButton.addClickListener(self)
topPanel = DockPanel()
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
topPanel.add(self.prevButton, DockPanel.WEST)
topPanel.add(self.nextButton, DockPanel.EAST)
topPanel.add(self.loadingImage, DockPanel.CENTER)
panel = VerticalPanel()
panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
panel.add(topPanel)
panel.add(self.image)
panel.setWidth("100%")
self.initWidget(panel)
self.image.setStyleName("ks-images-Image")
self.nextButton.setStyleName("ks-images-Button")
self.prevButton.setStyleName("ks-images-Button")
self.loadImage(0)
示例3: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
def __init__(self, chart):
self.chart = chart
self.canvas = chart.canvas
self.b2 = Button("Compositing", self)
self.b3 = Button("Paths & shapes", self)
self.b4 = Button("Arcs & circles", self)
self.b1 = Button("Bezier curves", self)
self.b6 = Button("Colors", self)
self.b7 = Button("Translating", self)
self.b8 = Button("Scaling", self)
self.b5 = Button("Rotating", self)
self.b10 = Button("Transparency", self)
self.b11 = Button("Lines", self)
self.b9 = Button("Animations", self)
hp = HorizontalPanel()
vp = VerticalPanel()
vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
vp.add(Label("MENU"))
vp.setSpacing(6)
vp.add(self.b2)
vp.add(self.b3)
vp.add(self.b4)
vp.add(self.b1)
vp.add(self.b6)
vp.add(self.b7)
vp.add(self.b8)
vp.add(self.b5)
vp.add(self.b10)
vp.add(self.b11)
vp.add(self.b9)
hp.add(vp)
Composite.__init__(self, hp)
示例4: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
def __init__(self):
SimplePanel.__init__(self)
panel = VerticalPanel()
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.setCellHeight(part1, "10%")
panel.setCellHeight(part2, "70%")
panel.setCellHeight(part3, "10%")
panel.setCellHeight(part4, "10%")
panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)
panel.setWidth("50%")
panel.setHeight("300px")
self.add(panel)
示例5: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [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")
示例6: createImage
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
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
示例7: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [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)
示例8: AlarmWidget
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setHorizontalAlignment [as 别名]
class AlarmWidget(object):
weekday_name = { 0: 'Mo', 1: 'Di', 2: 'Mi', 3: 'Do', 4: 'Fr', 5: 'Sa', 6: 'So' }
def __init__(self):
self.alarms = Alarms(self)
self.make_table()
self.fill_table()
self.status = Label()
self.panel = self.make_panel()
def make_panel(self):
message = Label(
'The configuration has been changed.\n'
'You must apply the changes in order for them to take effect.')
DOM.setStyleAttribute(message.getElement(), "whiteSpace", 'pre')
msgbox = Grid(1, 2, StyleName='changes')
msgbox.setWidget(0, 0, Image('icons/exclam.png'))
msgbox.setWidget(0, 1, message)
msgbox.getCellFormatter().setStyleName(0, 0, 'changes-image')
msgbox.getCellFormatter().setStyleName(0, 1, 'changes-text')
button = Button('apply changes')
button.addClickListener(self.apply_clicked)
self.changes = VerticalPanel()
self.changes.setHorizontalAlignment('right')
self.changes.setVisible(False)
self.changes.add(msgbox)
self.changes.add(button)
panel = VerticalPanel()
panel.setSpacing(10)
panel.add(self.table)
panel.add(self.status)
panel.add(self.changes)
return panel
def make_table(self):
self.table = FlexTable(StyleName='alarms')
self.table.setBorderWidth(1)
self.make_header()
self.make_footer()
def make_header(self):
headers = [ 'Time', 'Days', 'Duration' ]
for col, text in enumerate(headers):
self.table.setText(0, col, text)
self.table.getCellFormatter().setStyleName(0, col, 'tablecell header')
def make_footer(self):
self.time = {}
self.time['hour'] = ListBox()
self.time['hour'].setVisibleItemCount(1)
for hour in range(24):
self.time['hour'].addItem('%02d' % hour)
self.time['hour'].setSelectedIndex(12)
self.time['minute'] = ListBox()
self.time['minute'].setVisibleItemCount(1)
for minute in range(0, 60, 5):
self.time['minute'].addItem('%02d' % minute)
self.time['minute'].setSelectedIndex(0)
time_panel = HorizontalPanel()
time_panel.setVerticalAlignment('center')
time_panel.add(self.time['hour'])
time_panel.add(Label(':'))
time_panel.add(self.time['minute'])
self.table.setWidget(1, 0, time_panel)
weekdays_panel = HorizontalPanel()
weekdays_panel.setSpacing(5)
self.weekdays = {}
for i in range(7):
self.weekdays[i] = CheckBox(AlarmWidget.weekday_name[i])
self.weekdays[i].setChecked(i < 6)
weekdays_panel.add(self.weekdays[i])
self.table.setWidget(1, 1, weekdays_panel)
self.duration = ListBox()
self.duration.setVisibleItemCount(1)
choices = [ 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60 ]
for seconds in choices:
self.duration.addItem(
'%ds' % seconds if seconds < 60 else '%dm' % (seconds / 60),
seconds)
self.duration.setSelectedIndex(2)
self.table.setWidget(1, 2, self.duration)
image = Image('icons/plus.png')
image.setTitle('add');
image.addClickListener(self.plus_clicked)
self.table.setWidget(1, 3, image)
for col in range(4):
self.table.getCellFormatter().setStyleName(1, col, 'tablecell noborder')
#.........这里部分代码省略.........