本文整理汇总了Python中pychess.System.uistuff.keepWindowSize函数的典型用法代码示例。如果您正苦于以下问题:Python keepWindowSize函数的具体用法?Python keepWindowSize怎么用?Python keepWindowSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了keepWindowSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUi
def initUi (self):
self.window = Gtk.Window()
self.window.set_border_width(12)
self.window.set_icon_name("pychess")
self.window.set_title("PyChess - Internet Chess Chat")
self.window.connect("delete-event", lambda w,e: w.hide() or True)
uistuff.keepWindowSize("chatwindow", self.window, defaultSize=(650,400))
dock = PyDockTop("icchat")
dock.show()
self.window.add(dock)
leaf = dock.dock(self.viewspanel, CENTER, Gtk.Label(label="chat"), "chat")
leaf.setDockable(False)
self.channelspanel.connect('conversationAdded', self.onConversationAdded)
self.channelspanel.connect('conversationRemoved', self.onConversationRemoved)
self.channelspanel.connect('conversationSelected', self.onConversationSelected)
leaf.dock(self.channelspanel, WEST, Gtk.Label(label=_("Conversations")), "conversations")
leaf.dock(self.infopanel, EAST, Gtk.Label(label=_("Conversation info")), "info")
for panel in self.panels:
panel.show_all()
panel.start()
示例2: __init__
def __init__ (self):
self.connection = None
self.lounge = None
self.canceled = False
self.cids = defaultdict(list)
self.widgets = uistuff.GladeWidgets("fics_logon.glade")
uistuff.keepWindowSize("fics_logon", self.widgets["fics_logon"],
defaultPosition=uistuff.POSITION_GOLDEN)
self.widgets["fics_logon"].connect('key-press-event',
lambda w, e: e.keyval == Gdk.KEY_Escape and w.hide())
def on_logOnAsGuest_toggled (check):
self.widgets["passwordLabel"].set_sensitive(not check.get_active())
self.widgets["passEntry"].set_sensitive(not check.get_active())
self.widgets["logOnAsGuest"].connect("toggled", on_logOnAsGuest_toggled)
uistuff.keep(self.widgets["logOnAsGuest"], "logOnAsGuest")
uistuff.keep(self.widgets["nameEntry"], "usernameEntry")
uistuff.keep(self.widgets["passEntry"], "passwordEntry")
self.infobar = Gtk.InfoBar()
self.infobar.set_message_type(Gtk.MessageType.WARNING)
#self.widgets["messagePanelHBox"].pack_start(self.infobar,
# expand=False, fill=False)
self.widgets["messagePanelHBox"].pack_start(self.infobar,
False, False, 0)
self.widgets["cancelButton"].connect("clicked", self.onCancel, True)
self.widgets["stopButton"].connect("clicked", self.onCancel, False)
self.widgets["createNewButton"].connect("clicked", self.onCreateNew)
self.widgets["connectButton"].connect("clicked", self.onConnectClicked)
self.widgets["progressbar"].set_show_text(True)
示例3: __init__
def __init__ (self):
self.widgets = uistuff.GladeWidgets("fics_logon.glade")
uistuff.keepWindowSize("fics_logon", self.widgets["fics_logon"],
defaultPosition=uistuff.POSITION_GOLDEN)
self.widgets["fics_logon"].connect('key-press-event',
lambda w, e: e.keyval == gtk.keysyms.Escape and w.hide())
def on_logOnAsGuest_toggled (check):
self.widgets["nameLabel"].set_sensitive(not check.get_active())
self.widgets["nameEntry"].set_sensitive(not check.get_active())
self.widgets["passwordLabel"].set_sensitive(not check.get_active())
self.widgets["passEntry"].set_sensitive(not check.get_active())
self.widgets["logOnAsGuest"].connect("toggled", on_logOnAsGuest_toggled)
uistuff.keep(self.widgets["logOnAsGuest"], "logOnAsGuest")
uistuff.keep(self.widgets["nameEntry"], "usernameEntry")
uistuff.keep(self.widgets["passEntry"], "passwordEntry")
uistuff.makeYellow(self.widgets["messagePanel"])
self.widgets["cancelButton"].connect("clicked", self.onCancel, True)
self.widgets["stopButton"].connect("clicked", self.onCancel, False)
self.widgets["fics_logon"].connect("delete-event", self.onClose)
self.widgets["createNewButton"].connect("clicked", self.onCreateNew)
self.widgets["connectButton"].connect("clicked", self.onConnectClicked)
self.connection = None
self.lounge = None
示例4: __init__
def __init__(self):
self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL, title=_("Ask for permissions"))
self.window.set_transient_for(mainwindow())
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
gtk_version = (Gtk.get_major_version(), Gtk.get_minor_version())
if gtk_version >= (3, 12):
vbox.props.margin_start = 9
vbox.props.margin_end = 9
else:
vbox.props.margin_left = 9
vbox.props.margin_right = 9
vbox.props.margin_bottom = 9
self.window.add(vbox)
uistuff.keepWindowSize("externalsdialog", self.window, (320, 240), uistuff.POSITION_CENTER)
label = Gtk.Label(_("Some of PyChess features needs your permission to download external programs"))
vbox.pack_start(label, True, True, 0)
box = Gtk.Box()
check_button = Gtk.CheckButton(_("database querying needs scoutfish"))
check_button.set_active(conf.get("download_scoutfish", False))
check_button.connect("toggled", lambda w: conf.set("download_scoutfish", w.get_active()))
box.add(check_button)
link = "https://github.com/pychess/scoutfish"
link_button = Gtk.LinkButton(link, link)
box.add(link_button)
vbox.pack_start(box, False, False, 0)
box = Gtk.Box()
check_button = Gtk.CheckButton(_("database opening tree needs chess_db"))
check_button.set_active(conf.get("download_chess_db", False))
check_button.connect("toggled", lambda w: conf.set("download_chess_db", w.get_active()))
box.add(check_button)
link = "https://github.com/pychess/chess_db"
link_button = Gtk.LinkButton(link, link)
box.add(link_button)
vbox.pack_start(box, False, False, 0)
box = Gtk.Box()
check_button = Gtk.CheckButton(_("ICC lag compensation needs timestamp"))
check_button.set_active(conf.get("download_timestamp", False))
check_button.connect("toggled", lambda w: conf.set("download_timestamp", w.get_active()))
box.add(check_button)
link = "https://www.chessclub.com/user/resources/icc/timestamp"
link_button = Gtk.LinkButton(link, link)
box.add(link_button)
vbox.pack_start(box, False, False, 0)
check_button = Gtk.CheckButton(_("Don't show this dialog on startup."))
check_button.set_active(conf.get("dont_show_externals_at_startup", False))
check_button.connect("toggled", lambda w: conf.set("dont_show_externals_at_startup", w.get_active()))
vbox.pack_start(check_button, True, True, 0)
buttonbox = Gtk.ButtonBox()
close_button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
close_button.connect("clicked", self.on_close_clicked)
self.window.connect("delete_event", lambda w, a: self.window.destroy())
buttonbox.add(close_button)
vbox.pack_start(buttonbox, False, False, 0)
示例5: __init__
def __init__(self):
self.connection = None
self.lounge = None
self.canceled = False
self.cids = defaultdict(list)
self.widgets = uistuff.GladeWidgets("fics_logon.glade")
uistuff.keepWindowSize("fics_logon",
self.widgets["fics_logon"],
defaultPosition=uistuff.POSITION_GOLDEN)
self.widgets["fics_logon"].connect(
'key-press-event',
lambda w, e: e.keyval == Gdk.KEY_Escape and w.hide())
def on_logOnAsGuest_toggled(check):
names = get_user_names()
self.widgets["nameEntry"].set_text(names[1] if check.get_active()
else names[0])
self.widgets["passwordLabel"].set_sensitive(not check.get_active())
self.widgets["passEntry"].set_sensitive(not check.get_active())
self.widgets["logOnAsGuest"].connect("toggled",
on_logOnAsGuest_toggled)
uistuff.keep(self.widgets["logOnAsGuest"], "asGuestCheck")
as_guest = self.widgets["logOnAsGuest"]
def user_name_get_value(entry):
names = get_user_names()
if as_guest.get_active():
text = "%s|%s" % (names[0], entry.get_text())
else:
text = "%s|%s" % (entry.get_text(), names[1])
return text
def user_name_set_value(entry, value):
names = get_user_names(value=value)
if as_guest.get_active():
entry.set_text(names[1])
else:
entry.set_text(names[0])
uistuff.keep(self.widgets["nameEntry"], "usernameEntry",
user_name_get_value, user_name_set_value)
uistuff.keep(self.widgets["passEntry"], "passwordEntry")
uistuff.keep(self.widgets["hostEntry"], "hostEntry")
uistuff.keep(self.widgets["autoLogin"], "autoLogin")
self.infobar = Gtk.InfoBar()
self.infobar.set_message_type(Gtk.MessageType.WARNING)
# self.widgets["messagePanelHBox"].pack_start(self.infobar,
# expand=False, fill=False)
self.widgets["messagePanelHBox"].pack_start(self.infobar, False, False,
0)
self.widgets["cancelButton"].connect("clicked", self.onCancel, True)
self.widgets["stopButton"].connect("clicked", self.onCancel, False)
self.widgets["createNewButton"].connect("clicked", self.onCreateNew)
self.widgets["connectButton"].connect("clicked", self.onConnectClicked)
self.widgets["progressbar"].set_show_text(True)
示例6: __init__
def __init__(self):
self.widgets = uistuff.GladeWidgets("tipoftheday.glade")
self.widgets["window1"].set_transient_for(mainwindow())
uistuff.keepWindowSize("tipoftheday", self.widgets["window1"], (320, 240), uistuff.POSITION_CENTER)
self.widgets["checkbutton1"].set_active(conf.get("show_tip_at_startup"))
self.widgets["checkbutton1"].connect("toggled", lambda w: conf.set("show_tip_at_startup", w.get_active()))
self.widgets["close_button"].connect("clicked", lambda w: self.widgets["window1"].emit("delete-event", None))
self.widgets["window1"].connect("delete_event", lambda w, a: self.widgets["window1"].destroy())
self.widgets["back_button"].connect("clicked", lambda w: self.set_currentIndex(self.currentIndex - 1))
self.widgets["forward_button"].connect("clicked", lambda w: self.set_currentIndex(self.currentIndex + 1))
self.currentIndex = 0
示例7: initialize
def initialize(widgets):
GeneralTab(widgets)
HintTab(widgets)
SoundTab(widgets)
PanelTab(widgets)
ThemeTab(widgets)
uistuff.keepWindowSize("preferencesdialog", widgets["preferences"],
defaultPosition=POSITION_GOLDEN)
def delete_event (widget, *args):
widgets["preferences"].hide()
return True
widgets["preferences"].connect("delete-event", delete_event)
widgets["preferences"].connect("key-press-event",
lambda w,e: w.event(Gdk.Event(Gdk.EventType.DELETE))
if e.keyval == Gdk.KEY_Escape else None)
示例8: __init__
def __init__(self):
self.connection = None
self.helperconn = None
self.connection_task = None
self.helperconn_task = None
self.lounge = None
self.canceled = False
self.cids = defaultdict(list)
self.widgets = uistuff.GladeWidgets("fics_logon.glade")
uistuff.keepWindowSize("fics_logon",
self.widgets["fics_logon"],
defaultPosition=uistuff.POSITION_GOLDEN)
self.widgets["fics_logon"].connect(
'key-press-event',
lambda w, e: e.keyval == Gdk.KEY_Escape and w.hide())
self.ics = "FICS"
self.as_guest = self.widgets["logOnAsGuest"]
self.widgets["logOnAsGuest"].connect("toggled", self.on_logOnAsGuest_toggled)
def on_username_changed(widget):
conf.set("usernameEntry", self.user_name_get_value(widget), section=self.ics)
self.widgets["nameEntry"].connect("changed", on_username_changed)
def on_password_changed(widget):
conf.set("passwordEntry", widget.get_text(), section=self.ics)
self.widgets["passEntry"].connect("changed", on_password_changed)
def on_host_changed(widget):
conf.set("hostEntry", self.host_get_value(widget), section=self.ics)
self.widgets["hostEntry"].connect("changed", on_host_changed)
self.widgets["timesealCheck"].connect("toggled", self.on_timeseal_toggled)
self.infobar = Gtk.InfoBar()
self.infobar.set_message_type(Gtk.MessageType.WARNING)
# self.widgets["messagePanelHBox"].pack_start(self.infobar,
# expand=False, fill=False)
self.widgets["messagePanelHBox"].pack_start(self.infobar, False, False,
0)
self.widgets["cancelButton"].connect("clicked", self.onCancel, True)
self.widgets["stopButton"].connect("clicked", self.onCancel, False)
self.widgets["createNewButton"].connect("clicked", self.onCreateNew)
self.widgets["connectButton"].connect("clicked", self.onConnectClicked)
self.widgets["progressbar"].set_show_text(True)
示例9: __init__
def __init__ (self, widgets, connection):
self.connection = connection
self.window = Gtk.Window()
self.window.set_border_width(12)
self.window.set_icon_name("pychess")
self.window.set_title("FICS Console")
self.window.connect("delete-event", lambda w,e: w.hide() or True)
uistuff.keepWindowSize("consolewindow", self.window, defaultSize=(700,400))
self.consoleView = ConsoleView(self.connection)
self.window.add(self.consoleView)
widgets["show_console_button"].connect("clicked", self.showConsole)
connection.com.connect("consoleMessage", self.onConsoleMessage)
connection.connect("disconnected", self.onDisconnected)
示例10: initialize
def initialize(widgets):
GeneralTab(widgets)
HintTab(widgets)
SoundTab(widgets)
PanelTab(widgets)
ThemeTab(widgets)
def delete_event (widget, *args):
widgets["preferences"].hide()
return False
widgets["preferences"].connect("delete-event", delete_event)
widgets["preferences_close_button"].connect("clicked", delete_event)
widgets["preferences"].connect("key-press-event",
lambda w,e: delete_event(w) if e.keyval == gtk.keysyms.Escape else None)
uistuff.keepWindowSize("preferencesdialog", widgets["preferences"],
defaultPosition=POSITION_GOLDEN)
示例11: initialize
def initialize(widgets):
GeneralTab(widgets)
HintTab(widgets)
SoundTab(widgets)
PanelTab(widgets)
ThemeTab(widgets)
SaveTab(widgets)
widgets["preferences_notebook"].set_name("preferences_notebook")
uistuff.keepWindowSize("preferencesdialog", widgets["preferences_dialog"])
def delete_event(widget, *args):
widgets["preferences_dialog"].hide()
return True
widgets["preferences_dialog"].connect("delete-event", delete_event)
widgets["preferences_dialog"].connect(
"key-press-event",
lambda w, e: w.event(Gdk.Event(Gdk.EventType.DELETE)) if e.keyval == Gdk.KEY_Escape else None)
示例12: initialize
def initialize(widgets):
""" :Description: Initialises the various tabs for each section of configurable artifacts
"""
GeneralTab(widgets)
HintTab(widgets)
SoundTab(widgets)
PanelTab(widgets)
ThemeTab(widgets)
SaveTab(widgets)
uistuff.keepWindowSize("preferencesdialog", widgets["preferences_dialog"])
def delete_event(widget, _):
widgets["preferences_dialog"].hide()
return True
widgets["preferences_dialog"].connect("delete-event", delete_event)
widgets["preferences_dialog"].connect(
"key-press-event",
lambda w, e: w.event(Gdk.Event(Gdk.EventType.DELETE)) if e.keyval == Gdk.KEY_Escape else None)
示例13: _init
def _init(cls):
cls.tagToIter = {}
cls.tagToPage = {}
cls.pathToPage = {}
cls.tagToTime = {}
cls.window = Gtk.Window()
cls.window.set_title(_("PyChess Information Window"))
cls.window.set_border_width(12)
cls.window.set_icon_name("pychess")
uistuff.keepWindowSize("logdialog", cls.window, (640, 480))
mainHBox = Gtk.HBox()
mainHBox.set_spacing(6)
cls.window.add(mainHBox)
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
sw.set_shadow_type(Gtk.ShadowType.IN)
mainHBox.pack_start(sw, False, True, 0)
cls.treeview = Gtk.TreeView(Gtk.TreeStore(str))
cls.treeview.append_column(Gtk.TreeViewColumn("",
Gtk.CellRendererText(),
text=0))
cls.treeview.set_headers_visible(False)
cls.treeview.get_selection().set_mode(Gtk.SelectionMode.BROWSE)
sw.add(cls.treeview)
cls.pages = Gtk.Notebook()
cls.pages.set_show_tabs(False)
cls.pages.set_show_border(False)
mainHBox.pack_start(cls.pages, True, True, 0)
mainHBox.show_all()
def selectionChanged(selection):
treestore, iter = selection.get_selected()
if iter:
child = cls.pathToPage[treestore.get_path(iter).to_string()][
"child"]
cls.pages.set_current_page(cls.pages.page_num(child))
cls.treeview.get_selection().connect("changed", selectionChanged)
示例14: __init__
def __init__(self, widgets, connection):
self.connection = connection
self.window = Gtk.Window()
self.window.set_border_width(12)
# ChatWindow uses this to check is_active() so don't touch this!
self.window.set_icon_name("pychess")
self.window.set_title("%s Console" % connection.ics_name)
self.window.connect_after("delete-event",
lambda w, e: w.hide() or True)
uistuff.keepWindowSize("console", self.window, defaultSize=(800, 400))
self.consoleView = ConsoleView(self.window, self.connection)
self.window.add(self.consoleView)
widgets["show_console_button"].connect("clicked", self.showConsole)
connection.com.connect("consoleMessage", self.onConsoleMessage)
connection.connect("disconnected", self.onDisconnected)
示例15: _init
def _init (cls):
cls.widgets = uistuff.GladeWidgets("tipoftheday.glade")
uistuff.keepWindowSize("tipoftheday", cls.widgets["window1"],
(320,240), uistuff.POSITION_CENTER)
cls.widgets["checkbutton1"].set_active(conf.get("show_tip_at_startup", False))
cls.widgets["checkbutton1"].connect("toggled",
lambda w: conf.set("show_tip_at_startup", w.get_active()))
cls.widgets["close_button"].connect("clicked",
lambda w: cls.widgets["window1"].emit("delete-event", None))
cls.widgets["window1"].connect("delete_event",
lambda w, a: cls.widgets["window1"].hide())
cls.widgets["back_button"].connect("clicked",
lambda w: cls.set_currentIndex(cls.currentIndex-1))
cls.widgets["forward_button"].connect("clicked",
lambda w: cls.set_currentIndex(cls.currentIndex+1))
cls.currentIndex = 0