/usr/share/pypar2/src/dlgSavePar2.py is in pypar2 1.4-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # -*- coding: utf-8 -*-
#
# Author: Ingelrest François (Athropos@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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import consts, gtk, os
#==========================================================
#
# Functions
#
#==========================================================
def createDlg(parent) :
"""
Create and configure the dialog box
"""
global dlg, wTree
wTree = gtk.glade.XML(os.path.join(consts.dirRes, 'dlg-save.glade'), domain=consts.appNameShort)
dlg = wTree.get_widget('dlg-save')
# Configure the dialog
dlg.set_modal(True)
dlg.set_transient_for(parent)
dlg.connect('response', lambda dialog, response : dlg.hide())
def show(parent, defaultFile) :
"""
Show the dialog box, use defaultFile as the default filename
"""
if dlg is None :
createDlg(parent)
# set_filename() changes the current directory, if the file does not exist then nothing is selected
# set_current_name() must be used to provide a non-existing filename
dlg.set_filename(defaultFile)
slashIndex = defaultFile.rfind('/')
if slashIndex != -1 :
dlg.set_current_name(defaultFile[slashIndex+1:])
# Return the chosen filename, if any
if dlg.run() == gtk.RESPONSE_OK :
return dlg.get_filename()
return None
#==========================================================
#
# Entry point
#
#==========================================================
dlg = None
|