Gnome backgrounds, scanner app for VIP Express (circa Jun 2004)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

86 lines
2.4 KiB

#!/usr/bin/env python
# -*- coding: UTF8 -*-
# Python module denso.py
# Autogenerated from denso.glade
# Generated on Mon Mar 28 09:49:06 2005
# Warning: Do not delete or modify comments related to context
# They are required to keep user's code
import os, gtk
from SimpleGladeApp import SimpleGladeApp
glade_dir = ""
# Put your modules and data here
selected = False
# From here through main() codegen inserts/updates a class for
# every top-level widget in the .glade file.
class Window1(SimpleGladeApp):
def __init__(self, glade_path="denso.glade", root="window1", domain=None):
glade_path = os.path.join(glade_dir, glade_path)
SimpleGladeApp.__init__(self, glade_path, root, domain)
def new(self):
#context Window1.new {
pass
#context Window1.new }
#context Window1 custom methods {
def scan(self):
id = self.status.get_context_id("scan")
self.status.push(id, "Scanning...")
scanargs = '--brightness 30 --mode Gray --resolution 160'
scanpnm = 'scanimage %s > %s%s' % (scanargs,temp,pnmfile)
os.system(scanpnm)
def convert(self):
id = self.status.get_context_id("scan")
self.status.push(id, "Converting...")
convert = 'pnmscale 0.5 %s%s | pnmtojpeg > %s%s' % (temp,pnmfile,path,jpgfile)
cleanup = 'rm -f %s%s' % (temp,pnmfile)
os.system(convert)
os.system(cleanup)
#context Window1 custom methods }
def on_calendar_day_selected(self, widget, *args):
#context Window1.on_calendar_day_selected {
global file, temp, path, selected, pnmfile, jpgfile
year,month,day = self.calendar.get_date()
mo = month + 1
dy = day
yr = year - 2000
path = '~/Denso/'
temp = '/tmp/'
file = 'dar%02d%02d%02d' % (mo,dy,yr)
selection = '%02d/%02d/%02d' % (mo,dy,yr)
pnmfile = file + '.pnm'
jpgfile = file + '.jpg'
id = self.status.get_context_id("select")
self.status.push(id, selection)
selected = True
#context Window1.on_calendar_day_selected }
def on_scan_clicked(self, widget, *args):
#context Window1.on_scan_clicked {
id = self.status.get_context_id("click")
if not selected:
self.status.push(id, "Please select a date first!")
else:
self.scan()
self.convert()
result = 'Saved: %s%s' % (path,jpgfile)
self.status.push(id, result)
#context Window1.on_scan_clicked }
def main():
window1 = Window1()
window1.run()
if __name__ == "__main__":
main()