aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2019-12-12 17:21:17 -0800
committerMike Crute <mike@crute.us>2019-12-12 17:21:17 -0800
commitb3cff1bf5ad4a3dbdb244b9ec4a815bf9c244da2 (patch)
tree745cea0d2392cdcfbd348cbf2419b683727f3257
downloaddoxie-scanner-master.tar.bz2
doxie-scanner-master.tar.xz
doxie-scanner-master.zip
Initial importHEADmaster
-rw-r--r--README.txt3
-rwxr-xr-xmain.py109
-rw-r--r--process.txt4
3 files changed, 116 insertions, 0 deletions
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..71b5cc9
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,3 @@
1This repository is the start of an experiment to replace the Doxie software with
2an open-source GTK-based scanner software that works on Linux as well as Mac OS.
3It's not yet even remotely functional.
diff --git a/main.py b/main.py
new file mode 100755
index 0000000..60dee87
--- /dev/null
+++ b/main.py
@@ -0,0 +1,109 @@
1#!/usr/bin/env python3
2
3"""
4import gi
5gi.require_version('Gtk', '3.0')
6from gi.repository import Gtk, Gdk, GdkPixbuf
7
8import os
9
10class MyWindow(Gtk.Window):
11
12 def __init__(self):
13 super().__init__()
14
15 self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(6400, 6400, 6440))
16
17
18 fixed = Gtk.Fixed()
19
20 fixed.put(image1, 10, 10)
21 fixed.put(image2, 430, 10)
22 fixed.put(image3, 560, 10)
23
24 self.add(fixed)
25
26 self.set_border_width(20)
27 self.set_title("Fixed")
28
29 self.connect("destroy", Gtk.main_quit)
30
31win = MyWindow()
32win.show_all()
33Gtk.main()
34"""
35
36import gi, os
37gi.require_version('Gtk', '3.0')
38from gi.repository import Gtk, Gdk, GdkPixbuf
39
40class FlowBoxWindow(Gtk.Window):
41
42 def __init__(self):
43 Gtk.Window.__init__(self, title="FlowBox Demo")
44 self.set_border_width(10)
45 self.set_default_size(300, 250)
46
47 #header = Gtk.HeaderBar(title="Flow Box")
48 #header.set_subtitle("Sample FlowBox app")
49 #header.props.show_close_button = True
50
51 #self.set_titlebar(header)
52
53 scrolled = Gtk.ScrolledWindow()
54 scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
55
56 flowbox = Gtk.FlowBox()
57 flowbox.set_valign(Gtk.Align.START)
58 flowbox.set_max_children_per_line(30)
59 flowbox.set_selection_mode(Gtk.SelectionMode.NONE)
60
61 self.create_flowbox(flowbox)
62
63 scrolled.add(flowbox)
64
65 self.add(scrolled)
66 self.show_all()
67
68 def on_draw(self, widget, cr, data):
69 context = widget.get_style_context()
70
71 width = widget.get_allocated_width()
72 height = widget.get_allocated_height()
73 Gtk.render_background(context, cr, 0, 0, width, height)
74
75 r,g,b,a = data['color']
76 cr.set_source_rgba(r,g,b,a)
77 cr.rectangle(0, 0, width, height)
78 cr.fill()
79
80 def color_swatch_new(self, str_color):
81 color = Gdk.color_parse(str_color)
82
83 rgba = Gdk.RGBA.from_color(color)
84 button = Gtk.Button()
85
86 area = Gtk.DrawingArea()
87 area.set_size_request(24, 24)
88 area.connect("draw", self.on_draw, {'color': rgba})
89
90 button.add(area)
91
92 return button
93
94 def create_flowbox(self, flowbox):
95 base_path = os.path.expanduser("~/doxie")
96
97 for fn in os.listdir(base_path):
98 pb = GdkPixbuf.Pixbuf.new_from_file(os.path.join(base_path, fn))
99 img = Gtk.Image()
100 img.set_from_pixbuf(pb.scale_simple(300, 400, GdkPixbuf.InterpType.BILINEAR))
101 flowbox.add(img)
102
103
104
105
106win = FlowBoxWindow()
107win.connect("destroy", Gtk.main_quit)
108win.show_all()
109Gtk.main()
diff --git a/process.txt b/process.txt
new file mode 100644
index 0000000..ca75d86
--- /dev/null
+++ b/process.txt
@@ -0,0 +1,4 @@
1mount /mnt/doxie
2cp -r /mnt/doxie/DOXIE/JPEG ~/doxie
3rm /mnt/doxie/DOXIE/JPEG/*
4umount /mnt/doxie