本文整理匯總了Python中gtk.ScrolledWindow.set_policy方法的典型用法代碼示例。如果您正苦於以下問題:Python ScrolledWindow.set_policy方法的具體用法?Python ScrolledWindow.set_policy怎麽用?Python ScrolledWindow.set_policy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gtk.ScrolledWindow
的用法示例。
在下文中一共展示了ScrolledWindow.set_policy方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _setup_layout
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
def _setup_layout(self):
self.vbox = VBox(False, 0)
self.vbox.show()
self.terminal = terminal()
self.terminal.connect("child-exited", lambda _: self.close_button.show())
self.expander = expander_new_with_mnemonic(_("_Terminal"))
self.expander.set_expanded(False)
self.expander.add(self.terminal)
self.expander.show_all()
self.close_button = Button(stock=STOCK_CLOSE)
self.close_button.connect("clicked", lambda _: self.destroy())
scr = ScrolledWindow()
scr.set_policy ("automatic", "automatic")
scr.add (self.tree)
scr.show()
vpaned = VPaned()
vpaned.add1(scr)
vpaned.add2(self.expander)
vpaned.set_position (260)
vpaned.show()
self.vbox.pack_start(vpaned, True, True, 0)
self.vbox.pack_start(self.close_button, False, False, 0)
self.add(self.vbox)
return
示例2: _setup_layout
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
def _setup_layout(self):
hpaned = HPaned()
label = Label(_("Are you sure you want to install/remove those packages?"))
label.show()
inst_frame = Frame(_("Packages to install"))
rem_frame = Frame(_("Packages to remove"))
inst_scroll = ScrolledWindow()
inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
rem_scroll = ScrolledWindow()
rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
inst_scroll.add(self.install_tree)
rem_scroll.add(self.remove_tree)
inst_frame.add(inst_scroll)
rem_frame.add(rem_scroll)
hpaned.pack1(inst_frame, False, False)
hpaned.pack2(rem_frame, False, False)
hpaned.show_all()
self.vbox.pack_start(label, False, False, 0)
self.vbox.pack_start(hpaned, True, True, 0)
self.set_default_size(600,300)
return
示例3: _setup_layout
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
def _setup_layout(self):
self.set_default_size(600,200)
label = Label(_("Are you sure you want to install/remove those packages?\n"))
self.hpaned = HPaned()
inst_scroll = ScrolledWindow()
inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
rem_scroll = ScrolledWindow()
rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
inst_scroll.add(self.install_tree)
rem_scroll.add(self.remove_tree)
self.hpaned.pack1(inst_scroll, False, False)
self.hpaned.pack2(rem_scroll, False, False)
self.vbox.pack_start( label, False, False, 0 )
self.vbox.pack_start( self.hpaned, True, True, 0 )
self.vbox.pack_start( self.expander, False, False, 0 )
self.show_all()
self.expander.hide_all()
self.close_button.hide()
示例4: create_scrollwin
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
def create_scrollwin():
from gtk import ScrolledWindow, POLICY_AUTOMATIC
from gtk import SHADOW_IN
scrollwin = ScrolledWindow()
scrollwin.set_border_width(1)
scrollwin.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
scrollwin.set_shadow_type(SHADOW_IN)
return scrollwin
示例5: MDSplusMethodWidget
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
class MDSplusMethodWidget(Table):
def __init__(self,value=None):
super(MDSplusMethodWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.device=Entry()
self.method=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Device:"),0,1,0,1,0,0)
self.attach(self.device,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Method:"),0,1,1,2,0,0)
self.attach(self.method,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Method()
ans.method=self.method.get_text()
try:
ans.method=Data.compile(ans.method)
except Exception,e:
pass
try:
ans.object=Data.compile(self.device.get_text())
except Exception,e:
msg="Invalid device specified.\n\n%s" % (e,)
MDSplusErrorMsg('Invalid Device',msg)
raise
示例6: MDSplusRoutineWidget
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
class MDSplusRoutineWidget(Table):
def __init__(self,value=None):
super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.image=Entry()
self.routine=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Library:"),0,1,0,1,0,0)
self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Routine:"),0,1,1,2,0,0)
self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception,e:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception,e:
pass
示例7: MDSplusRoutineWidget
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
class MDSplusRoutineWidget(Table):
def __init__(self,value=None):
super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.image=Entry()
self.routine=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Library:"),0,1,0,1,0,0)
self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Routine:"),0,1,1,2,0,0)
self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception:
pass
if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
ans.timeout=None
else:
try:
ans.timeout=Data.compile(self.timeout.get_text())
except Exception:
msg="Invalid timeout specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Timeout',msg)
raise
idx=len(self.args)-1
found=False
while idx >= 0:
t = self.args[idx].get_text()
if t == '':
if found:
ans.setArgumentAt(idx,None)
else:
try:
a=Data.compile(t)
except Exception:
msg="Invalid argument specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Argument',msg)
raise
ans.setArgumentAt(idx,a)
found=True
idx=idx-1
return ans
def setValue(self,d):
self._value=d
self.reset()
def reset(self):
if isinstance(self._value,Routine):
self.image.set_text(self._value.image.decompile())
self.routine.set_text(self._value.routine.decompile())
if self._value.timeout is None or self._value.timeout.decompile() == '*':
self.timeout.set_text('')
else:
self.timeout.set_text(self._value.timeout.decompile())
idx=0
for arg in self.args:
if self._value.getArgumentAt(idx) is None:
arg.set_text('')
else:
arg.set_text(self._value.getArgumentAt(idx).decompile())
idx=idx+1
else:
self.image.set_text('')
self.routine.set_text('')
self.timeout.set_text('')
for arg in self.args:
arg.set_text('')
value=property(getValue,setValue)
def show(self):
old=self.get_no_show_all()
self.set_no_show_all(False)
#.........這裏部分代碼省略.........
示例8: __init__
# 需要導入模塊: from gtk import ScrolledWindow [as 別名]
# 或者: from gtk.ScrolledWindow import set_policy [as 別名]
def __init__(self,
trans, transid, plugin, gui_parent, change_register_function,
book, display_mode=TRANSACTION_ALL_EDIT_FIRST_TIME,
transaction_edit_finished_function=null_function):
self.trans = trans
self.transid = transid
self.plugin = plugin
self.gui_parent = gui_parent
self.change_register_function = change_register_function
self.book = book
self.display_mode = display_mode
self.transaction_edit_finished_function = (
null_function if display_mode not in HEADLESS_MODES
else transaction_edit_finished_function )
self.hide_parent = Window()
self.hide_parent.hide()
self.mainvbox = VBox()
self.hide_parent.add(self.mainvbox)
config = self.trans.get_configuration_and_provide_on_load_hook()
config_module_name = self.plugin.config_module_name
if not config_valid(config):
# even in the case of a broken config, we should still
# display all of the data we have available...
self.mainvbox.pack_start(Label("no configuration"))
elif not self.trans.can_safely_proceed_with_config_module(config):
# should display all data that's available instead of just
# this label
#
# and should give
# user an overide option where they either pick an old config
# for one time use or just blow out the memory of having used
# a different config...
#
# should also print the checksum itself so they know
# what they need...
#
# perhaps eventually we even put in place some archival support
# for saving old glade and config files and then code into the
# the transaction -- hey, code you need to be editable is
# over here..
#
# now hopefully there is no marking of this transaction dirty
# in this mode and the extra safegaurds we put into
# MultipageGladeTransaction don't get activated
self.mainvbox.pack_start(
Label("out of date configuration. data is read only here for "
"the safety of your old information, last adler "
"CRC was %s" % self.trans.config_crc_cache ))
else:
# if the safety cache was relied on before we need to tell the
# backend that the transaction is actually dirty,
# and now that we know that we have a workable config,
# there's a chance that we'll actually be able to avoid
# relying on the cache this time
if self.trans.get_safety_cache_was_used():
self.change_register_function()
self.page_label = Label("")
(x_align, y_align) = self.page_label.get_alignment()
self.page_label.set_alignment(0.0, y_align)
self.mainvbox.pack_start(self.page_label, expand=False)
# establish maincontainer, which is where the actual glade
# pages are put by attach_current_page
#
# The order of placement here is important, we place this
# after page_label has already been added to main
# and we also need to do this prior to attach_current_page
# being called, as it depends on self.maincontainer being
# there
#
# when we're in headless mode the maincontainer can just be
# the mainvbox itself
#
# but, outside headless mode we save screen real-estate and
# place a scrolled window (which becomes the maincontainer)
# inside the mainvbox and the glade by glade pages end up
# in there instead (again, in attach_current_page)
if display_mode in HEADLESS_MODES:
self.maincontainer = self.mainvbox
else:
self.maincontainer = Viewport()
sw = ScrolledWindow()
sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
sw.add( self.maincontainer)
self.mainvbox.pack_start(sw)
self.glade_pages = [
self.__setup_page(glade_file, top_glade_element)
for glade_file, top_glade_element in config.pages ]
self.glade_pages_by_ident_index = dict(
( (key, self.glade_pages[i])
for i, key in enumerate(config.pages)
) # end generator expression
) # end dict
self.__setup_auto_widgets()
#.........這裏部分代碼省略.........