search.py
来自「Ubuntu packages of security software。 相」· Python 代码 · 共 102 行
PY
102 行
#!/usr/bin/env python# -*- coding: utf-8 -*-# Copyright (C) 2005 Insecure.Com LLC.## Author: Adriano Monteiro Marques <py.adriano@gmail.com>## 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 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 USAimport gtkfrom higwidgets.higwindows import HIGWindowfrom higwidgets.higboxes import HIGVBoxfrom higwidgets.higbuttons import HIGButtonfrom higwidgets.higlabels import HIGEntryLabelfrom zenmapCore.I18N import _class SearchWindow(HIGWindow, object): """Search Window. Shows informations about the search while it's running """ def __init__(self): HIGWindow.__init__(self) self.__create_widgets() self.__pack_widgets() self.__set_widgets() def __create_widgets(self): self.vbox = HIGVBox() self.cancel_button = HIGButton(stock=gtk.STOCK_CANCEL) self.button_box = gtk.HButtonBox() self.search_file_label = HIGEntryLabel() self.progress = gtk.ProgressBar() def __pack_widgets(self): self.add(self.vbox) self.vbox.pack_start(self.search_file_label) self.vbox.pack_start(self.progress) self.vbox.pack_start(self.button_box) self.button_box.pack_start(self.cancel_button) def __set_widgets(self): self.button_box.set_layout(gtk.BUTTONBOX_END) self.set_title('Searching...') self.set_size_request(350, -1) self.set_position(gtk.WIN_POS_CENTER) def set_filename(self, filename): self.__filename = filename self.search_file_label.set_text(_("File: %s") % filename) def get_filename(self): return self.__filename def set_path(self, path): self.__path = path self.forward_progress_status() self.progress.set_text(_("Searching inside '%s'") % path) def get_path(self): return self.__path def set_fraction(self, fraction): self.__fraction = fraction def get_fraction(self): return self.__fraction def forward_progress_status(self): try: self.fraction except: self.fraction = 0.2 self.progress.set_fraction(self.fraction + self.progress.get_fraction()) filename = property(get_filename, set_filename, doc=_("File name been searched")) path = property(get_path, set_path, doc=_("Path been scanned")) fraction = property(get_fraction, set_fraction, doc=_("Fraction of the progress bar"))if __name__ == '__main__': s = SearchWindow() s.filename = 'filename' s.path = '/usr/local' s.show_all() gtk.main()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?