Post New Code Cleanup
@ -27,7 +27,6 @@ class MenuPopover(Gtk.Popover):
|
||||
self.set_size_request(360, -1)
|
||||
|
||||
def _setup_signals(self):
|
||||
# self.connect("grab-focus", self.set_revert_data)
|
||||
...
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
@ -45,10 +44,10 @@ class MenuPopover(Gtk.Popover):
|
||||
open_button = Gtk.Button(label = "Open")
|
||||
delete_button = Gtk.Button(label = "Delete")
|
||||
|
||||
revert_button.set_image( Gtk.Image.new_from_icon_name("gtk-undo", 16) )
|
||||
rename_button.set_image( Gtk.Image.new_from_icon_name("gtk-edit", 16) )
|
||||
open_button.set_image( Gtk.Image.new_from_icon_name("gtk-open", 16) )
|
||||
delete_button.set_image( Gtk.Image.new_from_icon_name("gtk-delete", 16) )
|
||||
revert_button.set_image( Gtk.Image.new_from_icon_name("gtk-undo", 4) )
|
||||
rename_button.set_image( Gtk.Image.new_from_icon_name("gtk-edit", 4) )
|
||||
open_button.set_image( Gtk.Image.new_from_icon_name("gtk-open", 4) )
|
||||
delete_button.set_image( Gtk.Image.new_from_icon_name("gtk-delete", 4) )
|
||||
|
||||
revert_button.set_always_show_image(True)
|
||||
rename_button.set_always_show_image(True)
|
||||
@ -113,5 +112,6 @@ class MenuPopover(Gtk.Popover):
|
||||
if os.path.isfile(file):
|
||||
os.remove(file)
|
||||
self.popdown()
|
||||
event_system.emit("unset_image_preview")
|
||||
except Exception as e:
|
||||
logger.info(e)
|
@ -33,9 +33,11 @@ class PreviewPane(Gtk.AspectFrame):
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe("set_image_to_view", self.set_image_to_view)
|
||||
event_system.subscribe("unset_image_preview", self.unset_image_preview)
|
||||
|
||||
def _load_widgets(self):
|
||||
self._preview_image = Gtk.Image()
|
||||
self.unset_image_preview()
|
||||
self.add(self._preview_image)
|
||||
|
||||
def set_image_to_view(self, image_file):
|
||||
@ -48,3 +50,7 @@ class PreviewPane(Gtk.AspectFrame):
|
||||
pixbuf = Gtk.Image.new_from_file(path).get_pixbuf()
|
||||
scaledPixBuf = pixbuf.scale_simple(480, 320, 2) # 2 = BILINEAR and is best by default
|
||||
self._preview_image.set_from_pixbuf(scaledPixBuf)
|
||||
|
||||
def unset_image_preview(self):
|
||||
pixbuf = Gtk.Image.new_from_icon_name("gtk-missing-image", 4).get_pixbuf()
|
||||
self._preview_image.set_from_pixbuf(pixbuf)
|
@ -1,39 +0,0 @@
|
||||
# Python imports
|
||||
import builtins, threading
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from utils.event_system import EventSystem
|
||||
from utils.endpoint_registry import EndpointRegistry
|
||||
from utils.settings import Settings
|
||||
|
||||
|
||||
|
||||
# NOTE: Threads WILL NOT die with parent's destruction.
|
||||
def threaded_wrapper(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
||||
return wrapper
|
||||
|
||||
# NOTE: Threads WILL die with parent's destruction.
|
||||
def daemon_threaded_wrapper(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
# NOTE: Just reminding myself we can add to builtins two different ways...
|
||||
# __builtins__.update({"event_system": Builtins()})
|
||||
builtins.app_name = "Cornea"
|
||||
builtins.threaded = threaded_wrapper
|
||||
builtins.daemon_threaded = daemon_threaded_wrapper
|
||||
|
||||
builtins.settings = Settings()
|
||||
builtins.logger = settings.get_logger()
|
||||
builtins.event_system = EventSystem()
|
||||
builtins.endpoint_registry = EndpointRegistry()
|
||||
|
||||
from utils.utils import Utils
|
||||
builtins.utils = Utils()
|
@ -1,3 +0,0 @@
|
||||
"""
|
||||
Base module
|
||||
"""
|
@ -1,36 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
|
||||
# Python imports
|
||||
import argparse, faulthandler, traceback
|
||||
from setproctitle import setproctitle
|
||||
|
||||
import tracemalloc
|
||||
tracemalloc.start()
|
||||
|
||||
# Lib imports
|
||||
import gi, faulthandler, signal
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from __builtins__ import *
|
||||
from app import Application
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
setproctitle('Cornea')
|
||||
faulthandler.enable() # For better debug info
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
# Add long and short arguments
|
||||
parser.add_argument("--file", "-f", default="firefox", help="JUST SOME FILE ARG.")
|
||||
# Read arguments (If any...)
|
||||
args, unknownargs = parser.parse_known_args()
|
||||
|
||||
Application(args, unknownargs)
|
||||
Gtk.main()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
quit()
|
@ -1,35 +0,0 @@
|
||||
# Python imports
|
||||
import inspect
|
||||
from setproctitle import setproctitle
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from core.main_window import MainWindow
|
||||
from core.drawing_area import DrawingArea
|
||||
from core.main_menu_popup import MainMenuPopup
|
||||
|
||||
|
||||
class Application:
|
||||
def __init__(self, args, unknownargs):
|
||||
builder = settings.get_builder()
|
||||
|
||||
# Gets the methods from the classes and sets to handler.
|
||||
# Then, builder connects to any signals it needs.
|
||||
classes = [
|
||||
MainWindow(),
|
||||
DrawingArea(),
|
||||
MainMenuPopup()
|
||||
]
|
||||
|
||||
handlers = {}
|
||||
for c in classes:
|
||||
methods = inspect.getmembers(c, predicate=inspect.ismethod)
|
||||
handlers.update(methods)
|
||||
|
||||
builder.connect_signals(handlers)
|
||||
window = settings.create_window()
|
||||
window.show()
|
@ -1,3 +0,0 @@
|
||||
"""
|
||||
Core module
|
||||
"""
|
@ -1,177 +0,0 @@
|
||||
# Python imports
|
||||
import html, time
|
||||
|
||||
import pyscreenshot as capture
|
||||
|
||||
# Lib imports
|
||||
import gi, cairo
|
||||
gi.require_version('Gdk', '3.0')
|
||||
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
|
||||
class MouseButtons:
|
||||
LEFT_BUTTON = 1
|
||||
RIGHT_BUTTON = 3
|
||||
|
||||
|
||||
class DrawingArea:
|
||||
def __init__(self):
|
||||
self.builder = settings.get_builder()
|
||||
self.main_window = self.builder.get_object('Main_Window')
|
||||
self.region_window = self.builder.get_object('Region_Window')
|
||||
self.region_menu = self.builder.get_object('regionMenu')
|
||||
self.message_label = self.builder.get_object('messageLabel')
|
||||
MONITOR = settings.get_monitor_data()
|
||||
|
||||
settings.set_window_data(self.region_window)
|
||||
self.region_window.set_default_size(MONITOR[0].width, MONITOR[0].height)
|
||||
self.region_window.set_size_request(MONITOR[0].width, MONITOR[0].height)
|
||||
self.region_window.set_keep_above(True)
|
||||
|
||||
self.DRAW_AREA = self.builder.get_object("selectionArea")
|
||||
self.DRAW_AREA.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
|
||||
self.DRAW_AREA.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
|
||||
self.DRAW_AREA.add_events(Gdk.EventMask.BUTTON1_MOTION_MASK)
|
||||
self.DRAW_AREA.connect("button-press-event", self.on_button_press)
|
||||
self.DRAW_AREA.connect("button-release-event", self.on_button_release)
|
||||
self.DRAW_AREA.connect("motion-notify-event", self.on_mouse_move)
|
||||
self.DRAW_AREA.connect("draw", self.on_draw)
|
||||
|
||||
area = settings.get_monitor_data()[0]
|
||||
self.SCREENSHOTS_DIR = settings.get_screenshots_dir()
|
||||
self.WIN_REC = [area.x, area.y, area.width, area.height]
|
||||
self.coords = [[0.0, 0.0], [0.0, 0.0]] # point1 and point2
|
||||
self.BORDER_COLOR = [255, 0, 0, 0.84]
|
||||
self.TRANS_COLOR = [0, 0, 0, 0.0]
|
||||
self.BG_COLOR = [0, 0, 0, 0.4]
|
||||
self.success = "#88cc27"
|
||||
self.warning = "#ffa800"
|
||||
self.error = "#ff0000"
|
||||
self.rec = None
|
||||
self.cr = None
|
||||
|
||||
self.region_window.set_default_size(area.width, area.height)
|
||||
self.region_window.set_size_request(area.width, area.height)
|
||||
self.region_window.move(area.x, area.y)
|
||||
self.region_window.set_resizable(False)
|
||||
self.region_window.set_keep_above(True)
|
||||
|
||||
|
||||
def on_button_press(self, w, e):
|
||||
self.message_label.set_markup("")
|
||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.LEFT_BUTTON:
|
||||
self.coords[0] = [e.x, e.y]
|
||||
self.region_menu.hide()
|
||||
|
||||
# This will reset draw area initially. No further use
|
||||
if self.cr:
|
||||
self.draw(self.cr, self.WIN_REC, self.BG_COLOR)
|
||||
self.DRAW_AREA.queue_draw()
|
||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
||||
self.region_menu.show()
|
||||
|
||||
# Update second set of coords.
|
||||
def on_mouse_move(self, w, e):
|
||||
self.coords[1] = [e.x, e.y]
|
||||
self.DRAW_AREA.queue_draw()
|
||||
|
||||
def on_button_release(self, w, e):
|
||||
if e.type == Gdk.EventType.BUTTON_RELEASE and e.button == MouseButtons.LEFT_BUTTON:
|
||||
self.region_menu.show()
|
||||
|
||||
@daemon_threaded
|
||||
def grab_region(self, widget):
|
||||
GLib.idle_add(self.main_window.hide)
|
||||
GLib.idle_add(self.region_menu.hide)
|
||||
|
||||
while self.main_window.is_visible():
|
||||
...
|
||||
while self.region_menu.is_visible():
|
||||
...
|
||||
|
||||
time.sleep(0.05)
|
||||
self.grab_region_idle()
|
||||
|
||||
def go_to_main_window(self, widget):
|
||||
self.go_to_main_window_idle()
|
||||
|
||||
def grab_region_idle(self):
|
||||
self.do_bounding_box_grab(self.rec[0], self.rec[1], self.rec[2], self.rec[3])
|
||||
GLib.idle_add(utils.referesh_directory_list)
|
||||
GLib.idle_add(self.main_window.show)
|
||||
GLib.idle_add(self.region_menu.show)
|
||||
|
||||
def go_to_main_window_idle(self):
|
||||
self.region_window.hide()
|
||||
self.region_menu.hide()
|
||||
self.main_window.show()
|
||||
|
||||
|
||||
def on_draw(self, wid, cr):
|
||||
if not self.cr: self.cr = cr
|
||||
# Reset the screen with transparent view
|
||||
self.draw(cr, self.WIN_REC, self.BG_COLOR)
|
||||
|
||||
point1 = self.coords[0]
|
||||
point2 = self.coords[1]
|
||||
x1 = point1[0]
|
||||
y1 = point1[1]
|
||||
x2 = point2[0]
|
||||
y2 = point2[1]
|
||||
w = x2 - x1
|
||||
h = y2 - y1
|
||||
|
||||
# Rectangle information for region and screen grab
|
||||
self.rec = [int(x1), int(y1), int(x2), int(y2)]
|
||||
# Draw the new selection region
|
||||
self.selection_draw(cr, [x1, y1, w, h], self.BORDER_COLOR, self.TRANS_COLOR)
|
||||
|
||||
|
||||
def draw(self, cr, x1y1wh, rgba):
|
||||
cr.set_source_rgba(rgba[0], rgba[1], rgba[2], rgba[3])
|
||||
cr.rectangle(x1y1wh[0], x1y1wh[1], x1y1wh[2], x1y1wh[3])
|
||||
cr.set_operator(1);
|
||||
cr.fill()
|
||||
|
||||
def selection_draw(self, cr, x1y1wh, brdrcol, transclr):
|
||||
# Clear the region
|
||||
cr.set_source_rgba(transclr[0], transclr[1], transclr[2], transclr[3])
|
||||
cr.rectangle(x1y1wh[0], x1y1wh[1], x1y1wh[2], x1y1wh[3])
|
||||
cr.set_operator(0);
|
||||
cr.fill()
|
||||
|
||||
# Draw a border
|
||||
cr.set_source_rgba(brdrcol[0], brdrcol[1], brdrcol[2], brdrcol[3])
|
||||
cr.rectangle(x1y1wh[0] - 2, x1y1wh[1] - 2, x1y1wh[2] + 4, x1y1wh[3] + 4)
|
||||
cr.set_operator(1);
|
||||
cr.stroke()
|
||||
|
||||
# Actual region grab
|
||||
def do_bounding_box_grab(self, x1, y1, x2, y2):
|
||||
try:
|
||||
temp = 0;
|
||||
if x2 < x1:
|
||||
temp = x1
|
||||
x1 = x2
|
||||
x2 = temp
|
||||
|
||||
if y2 < y1:
|
||||
temp = y1
|
||||
y1 = y2
|
||||
y2 = temp
|
||||
|
||||
|
||||
utils.do_bounding_box_grab(x1, y1, x2, y2)
|
||||
markup = "<span foreground='" + self.success + "'>Grabbed region successfully...</span>"
|
||||
GLib.idle_add(self.message_label.set_markup, markup)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
markup = "<span foreground='" + self.warning + "' >Oops...</span>" + \
|
||||
"\n<span foreground='" + self.error + "'>" + html.escape( str(e) ) + "</span>"
|
||||
GLib.idle_add(self.message_label.set_markup, markup)
|
@ -1,49 +0,0 @@
|
||||
# Python imports
|
||||
import os, subprocess
|
||||
|
||||
# lib imports
|
||||
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
class MainMenuPopup:
|
||||
def __init__(self):
|
||||
self.builder = settings.get_builder()
|
||||
self.file_name_entry = self.builder.get_object("fileNameEntry")
|
||||
self.SCREENSHOTS_DIR = settings.get_screenshots_dir()
|
||||
self.backup_name = None
|
||||
|
||||
|
||||
def rename_file(self, widget, data=None):
|
||||
new_name = self.file_name_entry.get_text().strip()
|
||||
old_file_path = f"{self.SCREENSHOTS_DIR}/{self.backup_name}"
|
||||
new_file_path = f"{self.SCREENSHOTS_DIR}/{new_name}"
|
||||
try:
|
||||
if os.path.isfile(old_file_path) and new_name:
|
||||
os.rename(old_file_path, new_file_path)
|
||||
self.backup_name = new_name
|
||||
utils.referesh_directory_list()
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
||||
def open_file(self, widget, data=None):
|
||||
file = f"{self.SCREENSHOTS_DIR}/{self.backup_name}"
|
||||
subprocess.Popen(['xdg-open', file], stdout=subprocess.PIPE)
|
||||
|
||||
def delete_file(self, widget, data=None):
|
||||
try:
|
||||
file = f"{self.SCREENSHOTS_DIR}/{self.backup_name}"
|
||||
if os.path.isfile(file):
|
||||
os.remove(file)
|
||||
self.builder.get_object("mainMenu").popdown()
|
||||
utils.referesh_directory_list()
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
||||
|
||||
def reset_name(self, widget, data=None):
|
||||
self.file_name_entry.set_text(self.backup_name)
|
||||
|
||||
def set_backup_var(self, widget):
|
||||
self.backup_name = self.file_name_entry.get_text()
|
@ -1,160 +0,0 @@
|
||||
# Python imports
|
||||
import os, signal, time
|
||||
import pyscreenshot as capture
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
gi.require_version('Gdk', '3.0')
|
||||
|
||||
from gi.repository import Gtk as Gtk
|
||||
from gi.repository import Gdk as Gdk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
class MouseButtons:
|
||||
LEFT_BUTTON = 1
|
||||
RIGHT_BUTTON = 3
|
||||
|
||||
|
||||
class MainWindow:
|
||||
def __init__(self):
|
||||
self.builder = settings.get_builder()
|
||||
self.main_window = self.builder.get_object('Main_Window')
|
||||
self.region_window = self.builder.get_object('Region_Window')
|
||||
self.monitors_view = self.builder.get_object("monitorsView")
|
||||
self.monitor_store = self.builder.get_object("monitorStore")
|
||||
self.MONITORS = settings.get_monitor_data()
|
||||
|
||||
# Not adding the reference monitor
|
||||
i = 0
|
||||
for monitor in self.MONITORS:
|
||||
if i > 0:
|
||||
mon = str(monitor.width) + "x" + str(monitor.height) + "+" + str(monitor.x) + "+" + str(monitor.y)
|
||||
self.monitor_store.append([mon])
|
||||
i += 1
|
||||
|
||||
self.monitors_view.set_cursor(1)
|
||||
|
||||
self.SCREENSHOTS_DIR = settings.get_screenshots_dir()
|
||||
utils.referesh_directory_list()
|
||||
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
|
||||
|
||||
|
||||
def take_screenshot(self, widget):
|
||||
active_radio = self.get_active_radio()
|
||||
active = active_radio.get_children()[0].get_text()
|
||||
|
||||
if "Entire screen" in active:
|
||||
self.grab_entire_screen()
|
||||
if "Active window" in active:
|
||||
self.get_active_window()
|
||||
if "Select a region" in active:
|
||||
self.region_window.show_all()
|
||||
if "Select a monitor" in active:
|
||||
self.snapshot_monitor()
|
||||
|
||||
|
||||
def grab_entire_screen(self):
|
||||
self.main_window.hide()
|
||||
self.get_entire_screen()
|
||||
|
||||
def get_entire_screen(self):
|
||||
# childprocess=False needed to not crash program
|
||||
im = capture.grab(childprocess=False)
|
||||
im.save(utils.generate_screenshot_name())
|
||||
self.main_window.show()
|
||||
utils.referesh_directory_list()
|
||||
|
||||
def get_active_window(self):
|
||||
utils.sleep()
|
||||
|
||||
screen = Gdk.get_default_root_window().get_screen()
|
||||
w = screen.get_active_window()
|
||||
pb = Gdk.pixbuf_get_from_window(w, *w.get_geometry())
|
||||
pb.savev(utils.generate_screenshot_name(), "png", (), ())
|
||||
utils.referesh_directory_list()
|
||||
|
||||
|
||||
|
||||
@daemon_threaded
|
||||
def snapshot_monitor(self):
|
||||
GLib.idle_add(self.main_window.hide)
|
||||
|
||||
while self.main_window.is_visible():
|
||||
...
|
||||
|
||||
time.sleep(0.05)
|
||||
GLib.idle_add(self.do_snapshot_monitor)
|
||||
|
||||
|
||||
def do_snapshot_monitor(self):
|
||||
iterator = self.monitors_view.get_selection().get_selected()[1]
|
||||
path = self.monitor_store.get_path(iterator)
|
||||
# Slot 0 is ref monitor. Need to add 1 to get proper slot
|
||||
monitor = self.MONITORS[int(str(path)) + 1]
|
||||
|
||||
utils.sleep()
|
||||
|
||||
x2 = monitor.x + monitor.width
|
||||
y2 = monitor.y + monitor.height
|
||||
utils.do_bounding_box_grab(monitor.x, monitor.y, x2, y2)
|
||||
utils.referesh_directory_list()
|
||||
self.main_window.show()
|
||||
|
||||
def toggle_radio_bttn(self, widget):
|
||||
delay_amount = self.builder.get_object('delayAmount')
|
||||
snapshot_bttn = self.builder.get_object('snapshotBttn')
|
||||
active = self.get_active_radio().get_children()[0].get_text()
|
||||
|
||||
self.region_window.hide()
|
||||
self.monitors_view.set_sensitive(False)
|
||||
delay_amount.set_sensitive(True)
|
||||
snapshot_bttn.set_sensitive(True)
|
||||
delay_amount.set_value(0)
|
||||
|
||||
if "Active window" in active:
|
||||
delay_amount.set_value(4)
|
||||
if "Select a region" in active:
|
||||
delay_amount.set_sensitive(False)
|
||||
if "Select a monitor" in active:
|
||||
self.monitors_view.set_sensitive(True)
|
||||
|
||||
def set_image(self, user_data):
|
||||
# We need the refresh state for the files list b/c GtkTreeSelection
|
||||
# is calling this method b/c caling this too quickly causes issues...
|
||||
if utils.get_refreshing_state() == False:
|
||||
selected = user_data.get_selected()[1]
|
||||
if selected:
|
||||
fileNameEntry = self.builder.get_object("fileNameEntry")
|
||||
imageView = self.builder.get_object("imageView")
|
||||
file = self.builder.get_object("fileStore").get_value(selected, 0)
|
||||
fullPath = f"{self.SCREENSHOTS_DIR}/{file}"
|
||||
|
||||
try:
|
||||
if os.path.isfile(fullPath):
|
||||
fileNameEntry.set_text(file)
|
||||
pixbuf = Gtk.Image.new_from_file(fullPath).get_pixbuf()
|
||||
scaledPixBuf = pixbuf.scale_simple(480, 320, 2) # 2 = BILINEAR and is best by default
|
||||
imageView.set_from_pixbuf(scaledPixBuf)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def get_active_radio(self):
|
||||
master_radio = self.builder.get_object('entireScrnToggle')
|
||||
active_radio = next((
|
||||
radio for radio in master_radio.get_group()
|
||||
if radio.get_active()
|
||||
))
|
||||
return active_radio
|
||||
|
||||
def show_main_menu(self, w, e):
|
||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
||||
self.builder.get_object("mainMenu").popup()
|
||||
|
||||
def close(self, widget):
|
||||
Gtk.main_quit()
|
@ -1,38 +0,0 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
class TreeMixin:
|
||||
def _create_treeview_widget(self, title = "Not Set"):
|
||||
# scroll = Gtk.ScrolledWindow()
|
||||
grid = Gtk.TreeView()
|
||||
store = Gtk.ListStore(str)
|
||||
column = Gtk.TreeViewColumn(title)
|
||||
name = Gtk.CellRendererText()
|
||||
selec = grid.get_selection()
|
||||
|
||||
grid.set_model(store)
|
||||
selec.set_mode(2)
|
||||
# scroll.set_size_request(145, 96)
|
||||
|
||||
column.pack_start(name, True)
|
||||
column.add_attribute(name, "text", 0)
|
||||
column.set_expand(False)
|
||||
|
||||
grid.append_column(column)
|
||||
grid.set_search_column(0)
|
||||
grid.set_headers_visible(True)
|
||||
grid.set_enable_tree_lines(False)
|
||||
|
||||
grid.show_all()
|
||||
# scroll.add(grid)
|
||||
grid.columns_autosize()
|
||||
# return scroll, store
|
||||
return grid, store
|
@ -1,3 +0,0 @@
|
||||
"""
|
||||
Utils module
|
||||
"""
|
@ -1,22 +0,0 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
|
||||
class EndpointRegistry():
|
||||
def __init__(self):
|
||||
self._endpoints = {}
|
||||
|
||||
def register(self, rule, **options):
|
||||
def decorator(f):
|
||||
self._endpoints[rule] = f
|
||||
return f
|
||||
|
||||
return decorator
|
||||
|
||||
def get_endpoints(self):
|
||||
return self._endpoints
|
@ -1,30 +0,0 @@
|
||||
# Python imports
|
||||
from collections import defaultdict
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
|
||||
class EventSystem:
|
||||
""" Create event system. """
|
||||
|
||||
def __init__(self):
|
||||
self.subscribers = defaultdict(list)
|
||||
|
||||
|
||||
def subscribe(self, event_type, fn):
|
||||
self.subscribers[event_type].append(fn)
|
||||
|
||||
def emit(self, event_type, data = None):
|
||||
if event_type in self.subscribers:
|
||||
for fn in self.subscribers[event_type]:
|
||||
if data:
|
||||
if hasattr(data, '__iter__') and not type(data) is str:
|
||||
fn(*data)
|
||||
else:
|
||||
fn(data)
|
||||
else:
|
||||
fn()
|
@ -1,56 +0,0 @@
|
||||
# Python imports
|
||||
import os, logging
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
class Logger:
|
||||
"""
|
||||
Create a new logging object and return it.
|
||||
:note:
|
||||
NOSET # Don't know the actual log level of this... (defaulting or literally none?)
|
||||
Log Levels (From least to most)
|
||||
Type Value
|
||||
CRITICAL 50
|
||||
ERROR 40
|
||||
WARNING 30
|
||||
INFO 20
|
||||
DEBUG 10
|
||||
:param loggerName: Sets the name of the logger object. (Used in log lines)
|
||||
:param createFile: Whether we create a log file or just pump to terminal
|
||||
|
||||
:return: the logging object we created
|
||||
"""
|
||||
|
||||
def __init__(self, config_path: str, _ch_log_lvl = logging.CRITICAL, _fh_log_lvl = logging.INFO):
|
||||
self._CONFIG_PATH = config_path
|
||||
self.global_lvl = logging.DEBUG # Keep this at highest so that handlers can filter to their desired levels
|
||||
self.ch_log_lvl = _ch_log_lvl # Prety much the only one we ever change
|
||||
self.fh_log_lvl = _fh_log_lvl
|
||||
|
||||
def get_logger(self, loggerName: str = "NO_LOGGER_NAME_PASSED", createFile: bool = True) -> logging.Logger:
|
||||
log = logging.getLogger(loggerName)
|
||||
log.setLevel(self.global_lvl)
|
||||
|
||||
# Set our log output styles
|
||||
fFormatter = logging.Formatter('[%(asctime)s] %(pathname)s:%(lineno)d %(levelname)s - %(message)s', '%m-%d %H:%M:%S')
|
||||
cFormatter = logging.Formatter('%(pathname)s:%(lineno)d] %(levelname)s - %(message)s')
|
||||
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(level=self.ch_log_lvl)
|
||||
ch.setFormatter(cFormatter)
|
||||
log.addHandler(ch)
|
||||
|
||||
if createFile:
|
||||
folder = self._CONFIG_PATH
|
||||
file = f"{folder}/application.log"
|
||||
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
|
||||
fh = logging.FileHandler(file)
|
||||
fh.setLevel(level=self.fh_log_lvl)
|
||||
fh.setFormatter(fFormatter)
|
||||
log.addHandler(fh)
|
||||
|
||||
return log
|
@ -1,91 +0,0 @@
|
||||
# Python imports
|
||||
import os
|
||||
|
||||
# Lib imports
|
||||
import gi, cairo
|
||||
gi.require_version('Gtk', '3.0')
|
||||
gi.require_version('Gdk', '3.0')
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
|
||||
|
||||
# Application imports
|
||||
from .logger import Logger
|
||||
|
||||
|
||||
|
||||
|
||||
class Settings:
|
||||
def __init__(self):
|
||||
self._SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||
self._USER_HOME = os.path.expanduser('~')
|
||||
self._CONFIG_PATH = f"{self._USER_HOME}/.config/{app_name.lower()}"
|
||||
self._GLADE_FILE = f"{self._CONFIG_PATH}/Main_Window.glade"
|
||||
self._CSS_FILE = f"{self._CONFIG_PATH}/stylesheet.css"
|
||||
self._DEFAULT_ICONS = f"{self._CONFIG_PATH}/icons"
|
||||
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
|
||||
self._USR_PATH = f"/usr/share/{app_name.lower()}"
|
||||
self._SCREENSHOTS_DIR = f"{self._USER_HOME}/.screenshots"
|
||||
|
||||
if not os.path.exists(self._CONFIG_PATH):
|
||||
os.mkdir(self._CONFIG_PATH)
|
||||
if not os.path.exists(self._GLADE_FILE):
|
||||
self._GLADE_FILE = f"{self._USR_PATH}/Main_Window.glade"
|
||||
if not os.path.exists(self._CSS_FILE):
|
||||
self._CSS_FILE = f"{self._USR_PATH}/stylesheet.css"
|
||||
if not os.path.exists(self._WINDOW_ICON):
|
||||
self._WINDOW_ICON = f"{self._USR_PATH}/icons/{app_name.lower()}.png"
|
||||
if not os.path.isdir(self._SCREENSHOTS_DIR):
|
||||
os.mkdir(self._SCREENSHOTS_DIR)
|
||||
|
||||
# 'Filters'
|
||||
self._images = ('.png', '.jpg', '.jpeg', '.gif')
|
||||
|
||||
self._builder = Gtk.Builder()
|
||||
self._builder.add_from_file(self._GLADE_FILE)
|
||||
self._logger = Logger(self._CONFIG_PATH, _fh_log_lvl=20).get_logger()
|
||||
|
||||
def create_window(self):
|
||||
# Get window and connect signals
|
||||
window = self._builder.get_object("Main_Window")
|
||||
window.connect("delete-event", Gtk.main_quit)
|
||||
self.set_window_data(window)
|
||||
return window
|
||||
|
||||
def set_window_data(self, window):
|
||||
screen = window.get_screen()
|
||||
visual = screen.get_rgba_visual()
|
||||
|
||||
if visual != None and screen.is_composited():
|
||||
window.set_visual(visual)
|
||||
|
||||
# bind css file
|
||||
css_provider = Gtk.CssProvider()
|
||||
css_provider.load_from_path(self._CSS_FILE)
|
||||
screen = Gdk.Screen.get_default()
|
||||
style_context = Gtk.StyleContext()
|
||||
style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
|
||||
def get_monitor_data(self):
|
||||
screen = self._builder.get_object("Main_Window").get_screen()
|
||||
wdth = screen.get_width()
|
||||
hght = screen.get_height()
|
||||
mon0 = Gdk.Rectangle()
|
||||
mon0.width = wdth
|
||||
mon0.height = hght
|
||||
monitors = []
|
||||
|
||||
monitors.append(mon0)
|
||||
for m in range(screen.get_n_monitors()):
|
||||
monitors.append(screen.get_monitor_geometry(m))
|
||||
|
||||
return monitors
|
||||
|
||||
|
||||
def get_builder(self) -> Gtk.Builder: return self._builder
|
||||
def get_logger(self) -> Logger: return self._logger
|
||||
def get_screenshots_dir(self) -> str: return self._SCREENSHOTS_DIR
|
||||
|
||||
# Filter returns
|
||||
def get_images_filter(self): return self._images
|
@ -1,89 +0,0 @@
|
||||
# Python imports
|
||||
import os, time, datetime
|
||||
|
||||
# Lib imports
|
||||
from gi.repository import GLib
|
||||
import pyscreenshot as capture
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
|
||||
class Utils:
|
||||
def __init__(self):
|
||||
self.builder = settings.get_builder()
|
||||
|
||||
self.SCREENSHOTS_DIR = settings.get_screenshots_dir()
|
||||
self.file_store = self.builder.get_object("fileStore")
|
||||
self.refreshing_state = False
|
||||
|
||||
|
||||
def get_refreshing_state(self):
|
||||
return self.refreshing_state
|
||||
|
||||
def set_refreshing_state(self, state):
|
||||
self.refreshing_state = state
|
||||
|
||||
|
||||
@threaded
|
||||
def referesh_directory_list(self):
|
||||
self.refreshing_state = True
|
||||
|
||||
images = self.get_directory_list()
|
||||
images.sort()
|
||||
if len(images) != len(self.file_store):
|
||||
self.file_store.clear()
|
||||
for image in images:
|
||||
GLib.idle_add(self.add_to_store, (image))
|
||||
|
||||
self.refreshing_state = False
|
||||
|
||||
|
||||
def add_to_store(self, image):
|
||||
self.file_store.append([image])
|
||||
|
||||
def get_directory_list(self):
|
||||
files = []
|
||||
|
||||
for file in os.listdir(self.SCREENSHOTS_DIR):
|
||||
if os.path.isfile(os.path.join(self.SCREENSHOTS_DIR, file)):
|
||||
files.append(file)
|
||||
|
||||
return files
|
||||
|
||||
|
||||
def do_bounding_box_grab(self, x1, y1, x2, y2):
|
||||
# childprocess=False needed to not crash program
|
||||
im = capture.grab(bbox=(x1, y1, x2, y2), childprocess=False)
|
||||
im.save(self.generate_screenshot_name())
|
||||
|
||||
def generate_screenshot_name(self):
|
||||
return f"{self.SCREENSHOTS_DIR}/scrshot_{self.get_time()}.png"
|
||||
|
||||
def get_time(self):
|
||||
now = datetime.datetime.now()
|
||||
return now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
def sleep(self, wait=None):
|
||||
delay_amount = self.builder.get_object("delayAmount")
|
||||
if not wait:
|
||||
wait = delay_amount.get_value_as_int()
|
||||
|
||||
time.sleep(wait)
|
||||
|
||||
|
||||
def get_clipboard_data(self):
|
||||
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout=subprocess.PIPE)
|
||||
retcode = proc.wait()
|
||||
data = proc.stdout.read()
|
||||
return data.decode("utf-8").strip()
|
||||
|
||||
def set_clipboard_data(self, data):
|
||||
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE)
|
||||
proc.stdin.write(data)
|
||||
proc.stdin.close()
|
||||
retcode = proc.wait()
|
||||
|
||||
def close(self, widget):
|
||||
gtk.main_quit()
|
@ -1,558 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="Region_Window">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="skip-taskbar-hint">True</property>
|
||||
<property name="skip-pager-hint">True</property>
|
||||
<property name="decorated">False</property>
|
||||
<property name="deletable">False</property>
|
||||
<property name="gravity">static</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="selectionArea">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="regionWindow"/>
|
||||
</style>
|
||||
</object>
|
||||
<object class="GtkListStore" id="fileStore">
|
||||
<columns>
|
||||
<!-- column-name Images -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkImage" id="grabRegionImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-copy</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="regionMenu">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="type">popup</property>
|
||||
<property name="window-position">mouse</property>
|
||||
<property name="type-hint">menu</property>
|
||||
<property name="decorated">False</property>
|
||||
<property name="gravity">north-east</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Grab Region</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="image">grabRegionImage</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="grab_region" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="go_to_main_window" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="messageLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="monitorStore">
|
||||
<columns>
|
||||
<!-- column-name Monitors -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkImage" id="picImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="renameImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="revertImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="timeoutAdjustment">
|
||||
<property name="upper">60</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="Main_Window">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">Cornea</property>
|
||||
<property name="window-position">center</property>
|
||||
<property name="default-width">500</property>
|
||||
<property name="default-height">310</property>
|
||||
<property name="icon">cornea.png</property>
|
||||
<property name="gravity">center</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="entireScrnToggle">
|
||||
<property name="label" translatable="yes">Entire screen</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Take a screenshot of the entire screen.</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="windowToggle">
|
||||
<property name="label" translatable="yes">Active window</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Take a screenshot of the active window.</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">entireScrnToggle</property>
|
||||
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="regionToggle">
|
||||
<property name="label" translatable="yes">Select a region</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Select a region to be captured by clicking a point of the screen without releasing the mouse, dragging you mouse to the other corner of the region, and releasing the mouse button.</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">entireScrnToggle</property>
|
||||
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="monitorToggle">
|
||||
<property name="label" translatable="yes">Select a monitor</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Take a screenshot of the selected monitor.</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">entireScrnToggle</property>
|
||||
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Timeout</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="delayAmount">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Delay in seconds before the screenshot is taken.</property>
|
||||
<property name="input-purpose">number</property>
|
||||
<property name="adjustment">timeoutAdjustment</property>
|
||||
<property name="snap-to-ticks">True</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="popup_bind_area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAspectFrame" id="previewPane">
|
||||
<property name="width-request">312</property>
|
||||
<property name="height-request">312</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="imageView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="snapshotBttn">
|
||||
<property name="label" translatable="yes">Take Snapshot</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="image">picImage</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="take_screenshot" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="monitorsView">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="model">monitorStore</property>
|
||||
<property name="headers-clickable">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">Monitors</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="width-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="margin-top">15</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="model">fileStore</property>
|
||||
<property name="headers-clickable">False</property>
|
||||
<signal name="button-press-event" handler="show_main_menu" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection">
|
||||
<signal name="changed" handler="set_image" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">Images</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="sort-order">descending</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="close" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="mainMenu">
|
||||
<property name="width-request">320</property>
|
||||
<property name="height-request">150</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="relative-to">popup_bind_area</property>
|
||||
<signal name="grab-focus" handler="set_backup_var" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="fileNameEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="has-focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Revert</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="image">revertImage</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="reset_name" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Rename</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="image">renameImage</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="rename_file" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="open_file" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="delete_file" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 858 B |
Before Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 925 B |
Before Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 707 B |
Before Width: | Height: | Size: 798 B |
Before Width: | Height: | Size: 989 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.8 KiB |