From b3cff1bf5ad4a3dbdb244b9ec4a815bf9c244da2 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Thu, 12 Dec 2019 17:21:17 -0800 Subject: Initial import --- README.txt | 3 ++ main.py | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ process.txt | 4 +++ 3 files changed, 116 insertions(+) create mode 100644 README.txt create mode 100755 main.py create mode 100644 process.txt diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..71b5cc9 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +This repository is the start of an experiment to replace the Doxie software with +an open-source GTK-based scanner software that works on Linux as well as Mac OS. +It'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 @@ +#!/usr/bin/env python3 + +""" +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk, Gdk, GdkPixbuf + +import os + +class MyWindow(Gtk.Window): + + def __init__(self): + super().__init__() + + self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(6400, 6400, 6440)) + + + fixed = Gtk.Fixed() + + fixed.put(image1, 10, 10) + fixed.put(image2, 430, 10) + fixed.put(image3, 560, 10) + + self.add(fixed) + + self.set_border_width(20) + self.set_title("Fixed") + + self.connect("destroy", Gtk.main_quit) + +win = MyWindow() +win.show_all() +Gtk.main() +""" + +import gi, os +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk, Gdk, GdkPixbuf + +class FlowBoxWindow(Gtk.Window): + + def __init__(self): + Gtk.Window.__init__(self, title="FlowBox Demo") + self.set_border_width(10) + self.set_default_size(300, 250) + + #header = Gtk.HeaderBar(title="Flow Box") + #header.set_subtitle("Sample FlowBox app") + #header.props.show_close_button = True + + #self.set_titlebar(header) + + scrolled = Gtk.ScrolledWindow() + scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) + + flowbox = Gtk.FlowBox() + flowbox.set_valign(Gtk.Align.START) + flowbox.set_max_children_per_line(30) + flowbox.set_selection_mode(Gtk.SelectionMode.NONE) + + self.create_flowbox(flowbox) + + scrolled.add(flowbox) + + self.add(scrolled) + self.show_all() + + def on_draw(self, widget, cr, data): + context = widget.get_style_context() + + width = widget.get_allocated_width() + height = widget.get_allocated_height() + Gtk.render_background(context, cr, 0, 0, width, height) + + r,g,b,a = data['color'] + cr.set_source_rgba(r,g,b,a) + cr.rectangle(0, 0, width, height) + cr.fill() + + def color_swatch_new(self, str_color): + color = Gdk.color_parse(str_color) + + rgba = Gdk.RGBA.from_color(color) + button = Gtk.Button() + + area = Gtk.DrawingArea() + area.set_size_request(24, 24) + area.connect("draw", self.on_draw, {'color': rgba}) + + button.add(area) + + return button + + def create_flowbox(self, flowbox): + base_path = os.path.expanduser("~/doxie") + + for fn in os.listdir(base_path): + pb = GdkPixbuf.Pixbuf.new_from_file(os.path.join(base_path, fn)) + img = Gtk.Image() + img.set_from_pixbuf(pb.scale_simple(300, 400, GdkPixbuf.InterpType.BILINEAR)) + flowbox.add(img) + + + + +win = FlowBoxWindow() +win.connect("destroy", Gtk.main_quit) +win.show_all() +Gtk.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 @@ +mount /mnt/doxie +cp -r /mnt/doxie/DOXIE/JPEG ~/doxie +rm /mnt/doxie/DOXIE/JPEG/* +umount /mnt/doxie -- cgit v1.2.3