📄 general_input.py
字号:
#!/usr/bin/env python# -*- coding: utf-8 -*-# Copyright (C) 1994 Ling Li## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Library General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.import gobject, gtkfrom gtk import *from coralftp_globals import *from utils import *class GeneralInputDialog(gobject.GObject): __gsignals__ = { 'response' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)), } def __init__(self, title, message, value): self.__gobject_init__() self.__tree = get_glade_xml('general_input_dialog') self.__tree.signal_autoconnect(self) self.__window = self.__tree.get_widget('general_input_dialog') self.__window.set_property('title', title) widget = self.__tree.get_widget('label_message') widget.set_text(message) widget = self.__tree.get_widget('entry_value') widget.set_text(value) def destroy(self): self.__window.destroy() return def on_response(self, obj, resp, *args): if resp in (RESPONSE_OK, RESPONSE_CLOSE, RESPONSE_CANCEL): self.__window.set_modal(FALSE) self.__window.hide() self.__value = self.__tree.get_widget('entry_value').get_text() self.emit('response', resp) return def run(self): self.__window.show() self.__window.set_modal(TRUE) def __getattr__(self, name): if name == 'value': return self.__value else: raise AttributeErrorgobject.type_register(GeneralInputDialog)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -