Made more pythonic
This commit is contained in:
parent
ec24e5fada
commit
1f08770f6e
|
@ -1,7 +1,5 @@
|
||||||
import builtins
|
|
||||||
|
|
||||||
# Python imports
|
# Python imports
|
||||||
import builtins
|
import builtins, threading
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
|
@ -9,12 +7,32 @@ import builtins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Builtins:
|
class Builtins:
|
||||||
"""Docstring for __builtins__ extender"""
|
"""Docstring for __builtins__ extender"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Just reminding myself we can add to builtins two different ways...
|
# NOTE: Just reminding myself we can add to builtins two different ways...
|
||||||
# __builtins__.update({"event_system": Builtins()})
|
# __builtins__.update({"event_system": Builtins()})
|
||||||
builtins.app_name = "Cornea"
|
builtins.app_name = "Cornea"
|
||||||
|
builtins.threaded = threaded_wrapper
|
||||||
|
builtins.daemon_threaded = daemon_threaded_wrapper
|
||||||
|
|
|
@ -1,33 +1,3 @@
|
||||||
# Python imports
|
"""
|
||||||
import inspect
|
Base module
|
||||||
from setproctitle import setproctitle
|
"""
|
||||||
|
|
||||||
# Lib imports
|
|
||||||
|
|
||||||
|
|
||||||
# Application imports
|
|
||||||
from __builtins__ import Builtins
|
|
||||||
from utils import Settings, CrossClassSignals
|
|
||||||
from signal_classes import MainWindow, DrawingArea, MainMenuPopup
|
|
||||||
|
|
||||||
|
|
||||||
class Main(Builtins):
|
|
||||||
def __init__(self, args):
|
|
||||||
settings = Settings()
|
|
||||||
builder = settings.returnBuilder()
|
|
||||||
|
|
||||||
# Gets the methods from the classes and sets to handler.
|
|
||||||
# Then, builder connects to any signals it needs.
|
|
||||||
utilsClass = CrossClassSignals(settings)
|
|
||||||
classes = [MainWindow(settings, utilsClass),
|
|
||||||
DrawingArea(settings, utilsClass),
|
|
||||||
MainMenuPopup(settings, utilsClass)]
|
|
||||||
|
|
||||||
handlers = {}
|
|
||||||
for c in classes:
|
|
||||||
methods = inspect.getmembers(c, predicate=inspect.ismethod)
|
|
||||||
handlers.update(methods)
|
|
||||||
|
|
||||||
builder.connect_signals(handlers)
|
|
||||||
window = settings.createWindow()
|
|
||||||
window.show()
|
|
||||||
|
|
|
@ -2,31 +2,34 @@
|
||||||
|
|
||||||
|
|
||||||
# Python imports
|
# Python imports
|
||||||
import argparse
|
import argparse, faulthandler, traceback
|
||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
|
import tracemalloc
|
||||||
|
tracemalloc.start()
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi, faulthandler, signal
|
import gi, faulthandler, signal
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import GLib
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from __init__ import Main
|
from app import Application
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
setproctitle('Cornea')
|
setproctitle('Cornea')
|
||||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
|
|
||||||
faulthandler.enable() # For better debug info
|
faulthandler.enable() # For better debug info
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
# Add long and short arguments
|
# Add long and short arguments
|
||||||
parser.add_argument("--file", "-f", default="firefox", help="JUST SOME FILE ARG.")
|
parser.add_argument("--file", "-f", default="firefox", help="JUST SOME FILE ARG.")
|
||||||
|
|
||||||
# Read arguments (If any...)
|
# Read arguments (If any...)
|
||||||
args = parser.parse_args()
|
args, unknownargs = parser.parse_known_args()
|
||||||
main = Main(args)
|
|
||||||
|
Application(args, unknownargs)
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print( repr(e) )
|
traceback.print_exc()
|
||||||
|
quit()
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Python imports
|
||||||
|
import inspect, signal
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
from __builtins__ import Builtins
|
||||||
|
from utils.settings import Settings
|
||||||
|
from utils.utils import Utils
|
||||||
|
from core.main_window import MainWindow
|
||||||
|
from core.drawing_area import DrawingArea
|
||||||
|
from core.Main_menu_popup import MainMenuPopup
|
||||||
|
|
||||||
|
|
||||||
|
class Application(Builtins):
|
||||||
|
def __init__(self, args, unknownargs):
|
||||||
|
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
|
||||||
|
|
||||||
|
settings = Settings()
|
||||||
|
builder = settings.get_builder()
|
||||||
|
|
||||||
|
# Gets the methods from the classes and sets to handler.
|
||||||
|
# Then, builder connects to any signals it needs.
|
||||||
|
utils = Utils(settings)
|
||||||
|
classes = [
|
||||||
|
MainWindow(settings, utils),
|
||||||
|
DrawingArea(settings, utils),
|
||||||
|
MainMenuPopup(settings, utils)
|
||||||
|
]
|
||||||
|
|
||||||
|
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()
|
|
@ -0,0 +1,52 @@
|
||||||
|
# Python imports
|
||||||
|
import os, subprocess
|
||||||
|
|
||||||
|
# lib imports
|
||||||
|
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
class MainMenuPopup:
|
||||||
|
def __init__(self, _settings, _utils):
|
||||||
|
self.settings = _settings
|
||||||
|
self.utils = _utils
|
||||||
|
|
||||||
|
self.builder = self.settings.get_builder()
|
||||||
|
self.file_name_entry = self.builder.get_object("fileNameEntry")
|
||||||
|
self.SCREENSHOTS_DIR = self.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
|
||||||
|
self.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()
|
||||||
|
self.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()
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Core module
|
||||||
|
"""
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import threading, html
|
import html, time
|
||||||
|
|
||||||
import pyscreenshot as capture
|
import pyscreenshot as capture
|
||||||
|
|
||||||
|
@ -14,11 +14,6 @@ from gi.repository import GLib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
class MouseButtons:
|
class MouseButtons:
|
||||||
LEFT_BUTTON = 1
|
LEFT_BUTTON = 1
|
||||||
|
@ -26,21 +21,21 @@ class MouseButtons:
|
||||||
|
|
||||||
|
|
||||||
class DrawingArea:
|
class DrawingArea:
|
||||||
def __init__(self, settings, utilsClass):
|
def __init__(self, _settings, _utils):
|
||||||
self.settings = settings
|
self.settings = _settings
|
||||||
self.utilsClass = utilsClass
|
self.utils = _utils
|
||||||
self.builder = self.settings.returnBuilder()
|
|
||||||
|
|
||||||
self.mainWindow = self.builder.get_object('Main_Window')
|
self.builder = self.settings.get_builder()
|
||||||
self.regionWindow = self.builder.get_object('Region_Window')
|
self.main_window = self.builder.get_object('Main_Window')
|
||||||
self.regionMenu = self.builder.get_object('regionMenu')
|
self.region_window = self.builder.get_object('Region_Window')
|
||||||
self.messageLabel = self.builder.get_object('messageLabel')
|
self.region_menu = self.builder.get_object('regionMenu')
|
||||||
MONITOR = self.settings.getMonitorData()
|
self.message_label = self.builder.get_object('messageLabel')
|
||||||
|
MONITOR = self.settings.get_monitor_data()
|
||||||
|
|
||||||
self.settings.setWindowData(self.regionWindow)
|
self.settings.set_window_data(self.region_window)
|
||||||
self.regionWindow.set_default_size(MONITOR[0].width, MONITOR[0].height)
|
self.region_window.set_default_size(MONITOR[0].width, MONITOR[0].height)
|
||||||
self.regionWindow.set_size_request(MONITOR[0].width, MONITOR[0].height)
|
self.region_window.set_size_request(MONITOR[0].width, MONITOR[0].height)
|
||||||
self.regionWindow.set_keep_above(True)
|
self.region_window.set_keep_above(True)
|
||||||
|
|
||||||
self.DRAW_AREA = self.builder.get_object("selectionArea")
|
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_PRESS_MASK)
|
||||||
|
@ -51,8 +46,8 @@ class DrawingArea:
|
||||||
self.DRAW_AREA.connect("motion-notify-event", self.on_mouse_move)
|
self.DRAW_AREA.connect("motion-notify-event", self.on_mouse_move)
|
||||||
self.DRAW_AREA.connect("draw", self.on_draw)
|
self.DRAW_AREA.connect("draw", self.on_draw)
|
||||||
|
|
||||||
area = self.settings.getMonitorData()[0]
|
area = self.settings.get_monitor_data()[0]
|
||||||
self.SCREENSHOTS_DIR = self.settings.returnScreenshotsDir()
|
self.SCREENSHOTS_DIR = self.settings.get_screenshots_dir()
|
||||||
self.WIN_REC = [area.x, area.y, area.width, area.height]
|
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.coords = [[0.0, 0.0], [0.0, 0.0]] # point1 and point2
|
||||||
self.BORDER_COLOR = [255, 0, 0, 0.84]
|
self.BORDER_COLOR = [255, 0, 0, 0.84]
|
||||||
|
@ -64,26 +59,25 @@ class DrawingArea:
|
||||||
self.rec = None
|
self.rec = None
|
||||||
self.cr = None
|
self.cr = None
|
||||||
|
|
||||||
self.regionWindow.set_default_size(area.width, area.height)
|
self.region_window.set_default_size(area.width, area.height)
|
||||||
self.regionWindow.set_size_request(area.width, area.height)
|
self.region_window.set_size_request(area.width, area.height)
|
||||||
self.regionWindow.move(area.x, area.y)
|
self.region_window.move(area.x, area.y)
|
||||||
self.regionWindow.set_resizable(False)
|
self.region_window.set_resizable(False)
|
||||||
self.regionWindow.set_keep_above(True)
|
self.region_window.set_keep_above(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_button_press(self, w, e):
|
def on_button_press(self, w, e):
|
||||||
self.messageLabel.set_markup("")
|
self.message_label.set_markup("")
|
||||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.LEFT_BUTTON:
|
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.LEFT_BUTTON:
|
||||||
self.coords[0] = [e.x, e.y]
|
self.coords[0] = [e.x, e.y]
|
||||||
self.regionMenu.hide()
|
self.region_menu.hide()
|
||||||
|
|
||||||
# This will reset draw area initially. No further use
|
# This will reset draw area initially. No further use
|
||||||
if self.cr:
|
if self.cr:
|
||||||
self.draw(self.cr, self.WIN_REC, self.BG_COLOR)
|
self.draw(self.cr, self.WIN_REC, self.BG_COLOR)
|
||||||
self.DRAW_AREA.queue_draw()
|
self.DRAW_AREA.queue_draw()
|
||||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
||||||
self.regionMenu.show()
|
self.region_menu.show()
|
||||||
|
|
||||||
# Update second set of coords.
|
# Update second set of coords.
|
||||||
def on_mouse_move(self, w, e):
|
def on_mouse_move(self, w, e):
|
||||||
|
@ -93,28 +87,29 @@ class DrawingArea:
|
||||||
@threaded
|
@threaded
|
||||||
def on_button_release(self, w, e):
|
def on_button_release(self, w, e):
|
||||||
if e.type == Gdk.EventType.BUTTON_RELEASE and e.button == MouseButtons.LEFT_BUTTON:
|
if e.type == Gdk.EventType.BUTTON_RELEASE and e.button == MouseButtons.LEFT_BUTTON:
|
||||||
GLib.idle_add(self.regionMenu.show)
|
GLib.idle_add(self.region_menu.show)
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def grabRegion(self, widget):
|
def grab_region(self, widget):
|
||||||
GLib.idle_add(self.grabRegionIdle)
|
self.main_window.hide()
|
||||||
|
self.region_menu.hide()
|
||||||
|
|
||||||
|
GLib.idle_add(self.grab_regionIdle)
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def returnToMainWindow(self, widget):
|
def go_to_main_window(self, widget):
|
||||||
GLib.idle_add(self.returnToMainWindowIdle)
|
GLib.idle_add(self.go_to_main_window_idle)
|
||||||
|
|
||||||
def grabRegionIdle(self):
|
def grab_regionIdle(self):
|
||||||
self.mainWindow.hide()
|
self.do_bounding_box_grab(self.rec[0], self.rec[1], self.rec[2], self.rec[3])
|
||||||
self.regionMenu.hide()
|
self.utils.referesh_directory_list()
|
||||||
self.boundingBoxGrab(self.rec[0], self.rec[1], self.rec[2], self.rec[3])
|
self.region_menu.show()
|
||||||
self.regionMenu.show()
|
self.main_window.show()
|
||||||
self.mainWindow.show()
|
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
|
|
||||||
def returnToMainWindowIdle(self):
|
def go_to_main_window_idle(self):
|
||||||
self.regionWindow.hide()
|
self.region_window.hide()
|
||||||
self.regionMenu.hide()
|
self.region_menu.hide()
|
||||||
self.mainWindow.show()
|
self.main_window.show()
|
||||||
|
|
||||||
|
|
||||||
def on_draw(self, wid, cr):
|
def on_draw(self, wid, cr):
|
||||||
|
@ -134,7 +129,7 @@ class DrawingArea:
|
||||||
# Rectangle information for region and screen grab
|
# Rectangle information for region and screen grab
|
||||||
self.rec = [int(x1), int(y1), int(x2), int(y2)]
|
self.rec = [int(x1), int(y1), int(x2), int(y2)]
|
||||||
# Draw the new selection region
|
# Draw the new selection region
|
||||||
self.selectionDraw(cr, [x1, y1, w, h], self.BORDER_COLOR, self.TRANS_COLOR)
|
self.selection_draw(cr, [x1, y1, w, h], self.BORDER_COLOR, self.TRANS_COLOR)
|
||||||
|
|
||||||
|
|
||||||
def draw(self, cr, x1y1wh, rgba):
|
def draw(self, cr, x1y1wh, rgba):
|
||||||
|
@ -143,7 +138,7 @@ class DrawingArea:
|
||||||
cr.set_operator(1);
|
cr.set_operator(1);
|
||||||
cr.fill()
|
cr.fill()
|
||||||
|
|
||||||
def selectionDraw(self, cr, x1y1wh, brdrcol, transclr):
|
def selection_draw(self, cr, x1y1wh, brdrcol, transclr):
|
||||||
# Clear the region
|
# Clear the region
|
||||||
cr.set_source_rgba(transclr[0], transclr[1], transclr[2], transclr[3])
|
cr.set_source_rgba(transclr[0], transclr[1], transclr[2], transclr[3])
|
||||||
cr.rectangle(x1y1wh[0], x1y1wh[1], x1y1wh[2], x1y1wh[3])
|
cr.rectangle(x1y1wh[0], x1y1wh[1], x1y1wh[2], x1y1wh[3])
|
||||||
|
@ -157,8 +152,8 @@ class DrawingArea:
|
||||||
cr.stroke()
|
cr.stroke()
|
||||||
|
|
||||||
# Actual region grab
|
# Actual region grab
|
||||||
def boundingBoxGrab(self, x1, y1, x2, y2):
|
def do_bounding_box_grab(self, x1, y1, x2, y2):
|
||||||
self.utilsClass.sleep(0.4)
|
self.utils.sleep(0.4)
|
||||||
try:
|
try:
|
||||||
temp = 0;
|
temp = 0;
|
||||||
if x2 < x1:
|
if x2 < x1:
|
||||||
|
@ -172,11 +167,11 @@ class DrawingArea:
|
||||||
y2 = temp
|
y2 = temp
|
||||||
|
|
||||||
|
|
||||||
self.utilsClass.boundingBoxGrab(x1, y1, x2, y2)
|
self.utils.do_bounding_box_grab(x1, y1, x2, y2)
|
||||||
markup = "<span foreground='" + self.success + "'>Grabbed region successfully...</span>"
|
markup = "<span foreground='" + self.success + "'>Grabbed region successfully...</span>"
|
||||||
GLib.idle_add(self.messageLabel.set_markup, markup)
|
GLib.idle_add(self.message_label.set_markup, markup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
markup = "<span foreground='" + self.warning + "' >Oops...</span>" + \
|
markup = "<span foreground='" + self.warning + "' >Oops...</span>" + \
|
||||||
"\n<span foreground='" + self.error + "'>" + html.escape( str(e) ) + "</span>"
|
"\n<span foreground='" + self.error + "'>" + html.escape( str(e) ) + "</span>"
|
||||||
GLib.idle_add(self.messageLabel.set_markup, markup)
|
GLib.idle_add(self.message_label.set_markup, markup)
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import threading, subprocess, os
|
import os
|
||||||
import pyscreenshot as capture
|
import pyscreenshot as capture
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
@ -9,15 +9,11 @@ gi.require_version('Gdk', '3.0')
|
||||||
|
|
||||||
from gi.repository import Gtk as Gtk
|
from gi.repository import Gtk as Gtk
|
||||||
from gi.repository import Gdk as Gdk
|
from gi.repository import Gdk as Gdk
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
class MouseButtons:
|
class MouseButtons:
|
||||||
LEFT_BUTTON = 1
|
LEFT_BUTTON = 1
|
||||||
|
@ -25,105 +21,107 @@ class MouseButtons:
|
||||||
|
|
||||||
|
|
||||||
class MainWindow:
|
class MainWindow:
|
||||||
def __init__(self, settings, utilsClass):
|
def __init__(self, _settings, _utils):
|
||||||
self.settings = settings
|
self.settings = _settings
|
||||||
self.utilsClass = utilsClass
|
self.utils = _utils
|
||||||
self.builder = self.settings.returnBuilder()
|
|
||||||
|
|
||||||
self.mainWindow = self.builder.get_object('Main_Window')
|
self.builder = self.settings.get_builder()
|
||||||
self.regionWindow = self.builder.get_object('Region_Window')
|
self.main_window = self.builder.get_object('Main_Window')
|
||||||
self.monitorStore = self.builder.get_object("monitorStore")
|
self.region_window = self.builder.get_object('Region_Window')
|
||||||
self.MONITORS = self.settings.getMonitorData()
|
self.monitors_view = self.builder.get_object("monitorsView")
|
||||||
|
self.monitor_store = self.builder.get_object("monitorStore")
|
||||||
|
self.MONITORS = self.settings.get_monitor_data()
|
||||||
|
|
||||||
# Not adding the reference monitor
|
# Not adding the reference monitor
|
||||||
i = 0
|
i = 0
|
||||||
for monitor in self.MONITORS:
|
for monitor in self.MONITORS:
|
||||||
if i > 0:
|
if i > 0:
|
||||||
mon = str(monitor.width) + "x" + str(monitor.height) + "+" + str(monitor.x) + "+" + str(monitor.y)
|
mon = str(monitor.width) + "x" + str(monitor.height) + "+" + str(monitor.x) + "+" + str(monitor.y)
|
||||||
self.monitorStore.append([mon])
|
self.monitor_store.append([mon])
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
monitorsView = self.builder.get_object("monitorsView")
|
self.monitors_view.set_cursor(1)
|
||||||
monitorsView.set_cursor(1)
|
|
||||||
|
|
||||||
self.SCREENSHOTS_DIR = self.settings.returnScreenshotsDir()
|
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
|
|
||||||
|
self.SCREENSHOTS_DIR = self.settings.get_screenshots_dir()
|
||||||
|
self.utils.referesh_directory_list()
|
||||||
|
|
||||||
|
|
||||||
def take_screenshot(self, widget):
|
def take_screenshot(self, widget):
|
||||||
active_radio = self.getActiveRadio()
|
active_radio = self.get_active_radio()
|
||||||
active = active_radio.get_children()[0].get_text()
|
active = active_radio.get_children()[0].get_text()
|
||||||
|
|
||||||
if "Entire screen" in active:
|
if "Entire screen" in active:
|
||||||
self.getEntireScreen()
|
self.grab_entire_screen()
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
if "Active window" in active:
|
if "Active window" in active:
|
||||||
self.getActiveWindow()
|
self.get_active_window()
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
if "Select a region" in active:
|
if "Select a region" in active:
|
||||||
self.regionWindow.show_all()
|
self.region_window.show_all()
|
||||||
if "Select a monitor" in active:
|
if "Select a monitor" in active:
|
||||||
self.snapshotMonitor()
|
self.snapshot_monitor()
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
|
|
||||||
|
|
||||||
def getEntireScreen(self):
|
@threaded
|
||||||
self.utilsClass.sleep()
|
def grab_entire_screen(self):
|
||||||
|
self.main_window.hide()
|
||||||
|
GLib.idle_add(self.get_entire_screen)
|
||||||
|
|
||||||
|
def get_entire_screen(self):
|
||||||
# childprocess=False needed to not crash program
|
# childprocess=False needed to not crash program
|
||||||
im = capture.grab(childprocess=False)
|
im = capture.grab(childprocess=False)
|
||||||
im.save(self.utilsClass.generateScreenshotName())
|
im.save(self.utils.generate_screenshot_name())
|
||||||
|
self.main_window.show()
|
||||||
|
self.utils.referesh_directory_list()
|
||||||
|
|
||||||
def getActiveWindow(self):
|
def get_active_window(self):
|
||||||
self.utilsClass.sleep()
|
self.utils.sleep()
|
||||||
|
|
||||||
screen = Gdk.get_default_root_window().get_screen()
|
screen = Gdk.get_default_root_window().get_screen()
|
||||||
w = screen.get_active_window()
|
w = screen.get_active_window()
|
||||||
pb = Gdk.pixbuf_get_from_window(w, *w.get_geometry())
|
pb = Gdk.pixbuf_get_from_window(w, *w.get_geometry())
|
||||||
pb.savev(self.utilsClass.generateScreenshotName(), "png", (), ())
|
pb.savev(self.utils.generate_screenshot_name(), "png", (), ())
|
||||||
|
self.utils.referesh_directory_list()
|
||||||
|
|
||||||
def snapshotMonitor(self):
|
def snapshot_monitor(self):
|
||||||
monitorsView = self.builder.get_object("monitorsView")
|
iterator = self.monitors_view.get_selection().get_selected()[1]
|
||||||
iterator = monitorsView.get_selection().get_selected()[1]
|
path = self.monitor_store.get_path(iterator)
|
||||||
path = self.monitorStore.get_path(iterator)
|
|
||||||
# Slot 0 is ref monitor. Need to add 1 to get proper slot
|
# Slot 0 is ref monitor. Need to add 1 to get proper slot
|
||||||
monitor = self.MONITORS[int(str(path)) + 1]
|
monitor = self.MONITORS[int(str(path)) + 1]
|
||||||
|
|
||||||
self.utilsClass.sleep()
|
self.utils.sleep()
|
||||||
|
|
||||||
x2 = monitor.x + monitor.width
|
x2 = monitor.x + monitor.width
|
||||||
y2 = monitor.y + monitor.height
|
y2 = monitor.y + monitor.height
|
||||||
self.utilsClass.boundingBoxGrab(monitor.x, monitor.y, x2, y2)
|
self.utils.do_bounding_box_grab(monitor.x, monitor.y, x2, y2)
|
||||||
|
self.utils.referesh_directory_list()
|
||||||
|
|
||||||
def toggleRadioBttn(self, widget):
|
def toggle_radio_bttn(self, widget):
|
||||||
monitorsView = self.builder.get_object('monitorsView')
|
delay_amount = self.builder.get_object('delayAmount')
|
||||||
delayAmount = self.builder.get_object('delayAmount')
|
snapshot_bttn = self.builder.get_object('snapshotBttn')
|
||||||
snapshotBttn = self.builder.get_object('snapshotBttn')
|
active = self.get_active_radio().get_children()[0].get_text()
|
||||||
active = self.getActiveRadio().get_children()[0].get_text()
|
|
||||||
|
|
||||||
self.regionWindow.hide()
|
self.region_window.hide()
|
||||||
monitorsView.set_sensitive(False)
|
self.monitors_view.set_sensitive(False)
|
||||||
delayAmount.set_sensitive(True)
|
delay_amount.set_sensitive(True)
|
||||||
snapshotBttn.set_sensitive(True)
|
snapshot_bttn.set_sensitive(True)
|
||||||
delayAmount.set_value(0)
|
delay_amount.set_value(0)
|
||||||
|
|
||||||
if "Active window" in active:
|
if "Active window" in active:
|
||||||
delayAmount.set_value(4)
|
delay_amount.set_value(4)
|
||||||
if "Select a region" in active:
|
if "Select a region" in active:
|
||||||
delayAmount.set_sensitive(False)
|
delay_amount.set_sensitive(False)
|
||||||
if "Select a monitor" in active:
|
if "Select a monitor" in active:
|
||||||
monitorsView.set_sensitive(True)
|
self.monitors_view.set_sensitive(True)
|
||||||
|
|
||||||
def setImage(self, user_data):
|
def set_image(self, user_data):
|
||||||
# We need the refresh state for the files list b/c GtkTreeSelection
|
# We need the refresh state for the files list b/c GtkTreeSelection
|
||||||
# is calling this method b/c caling this too quickly causes issues...
|
# is calling this method b/c caling this too quickly causes issues...
|
||||||
if self.utilsClass.returnRefreshingState() == False:
|
if self.utils.get_refreshing_state() == False:
|
||||||
selected = user_data.get_selected()[1]
|
selected = user_data.get_selected()[1]
|
||||||
if selected:
|
if selected:
|
||||||
fileNameEntry = self.builder.get_object("fileNameEntry")
|
fileNameEntry = self.builder.get_object("fileNameEntry")
|
||||||
imageView = self.builder.get_object("imageView")
|
imageView = self.builder.get_object("imageView")
|
||||||
file = self.builder.get_object("fileStore").get_value(selected, 0)
|
file = self.builder.get_object("fileStore").get_value(selected, 0)
|
||||||
fullPath = self.SCREENSHOTS_DIR + "/" + file
|
fullPath = f"{self.SCREENSHOTS_DIR}/{file}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if os.path.isfile(fullPath):
|
if os.path.isfile(fullPath):
|
||||||
|
@ -134,9 +132,7 @@ class MainWindow:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
def get_active_radio(self):
|
||||||
|
|
||||||
def getActiveRadio(self):
|
|
||||||
master_radio = self.builder.get_object('entireScrnToggle')
|
master_radio = self.builder.get_object('entireScrnToggle')
|
||||||
active_radio = next((
|
active_radio = next((
|
||||||
radio for radio in master_radio.get_group()
|
radio for radio in master_radio.get_group()
|
||||||
|
@ -144,7 +140,7 @@ class MainWindow:
|
||||||
))
|
))
|
||||||
return active_radio
|
return active_radio
|
||||||
|
|
||||||
def showMainMenu(self, w, e):
|
def show_main_menu(self, w, e):
|
||||||
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
if e.type == Gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
|
||||||
self.builder.get_object("mainMenu").popup()
|
self.builder.get_object("mainMenu").popup()
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# set -o xtrace ## To debug scripts
|
|
||||||
# set -o errexit ## To exit on error
|
|
||||||
# set -o errunset ## To exit if a variable is referenced but not set
|
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
||||||
# source "/home/abaddon/Portable_Apps/py-venvs/flask-apps-venv/venv/bin/activate"
|
|
||||||
python "${SCRIPTPATH}"
|
|
||||||
}
|
|
||||||
main $@;
|
|
|
@ -1,52 +0,0 @@
|
||||||
# Python imports
|
|
||||||
import os, subprocess
|
|
||||||
|
|
||||||
# lib imports
|
|
||||||
|
|
||||||
|
|
||||||
# Application imports
|
|
||||||
|
|
||||||
|
|
||||||
class MainMenuPopup:
|
|
||||||
def __init__(self, settings, utilsClass):
|
|
||||||
self.settings = settings
|
|
||||||
self.utilsClass = utilsClass
|
|
||||||
|
|
||||||
self.builder = self.settings.returnBuilder()
|
|
||||||
self.fileNameEntry = self.builder.get_object("fileNameEntry")
|
|
||||||
self.SCREENSHOTS_DIR = self.settings.returnScreenshotsDir()
|
|
||||||
self.backupName = None
|
|
||||||
|
|
||||||
|
|
||||||
def renameFile(self, widget, data=None):
|
|
||||||
newName = self.fileNameEntry.get_text().strip()
|
|
||||||
oldFilePath = self.SCREENSHOTS_DIR + '/' + self.backupName
|
|
||||||
newFilePath = self.SCREENSHOTS_DIR + '/' + newName
|
|
||||||
try:
|
|
||||||
if os.path.isfile(oldFilePath) and newName:
|
|
||||||
os.rename(oldFilePath, newFilePath)
|
|
||||||
self.backupName = newName
|
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
except Exception as e:
|
|
||||||
print(str(e))
|
|
||||||
|
|
||||||
def openFile(self, widget, data=None):
|
|
||||||
filePath = self.SCREENSHOTS_DIR + '/' + self.backupName
|
|
||||||
subprocess.Popen(['xdg-open', filePath], stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
def deleteFile(self, widget, data=None):
|
|
||||||
try:
|
|
||||||
filePath = self.SCREENSHOTS_DIR + '/' + self.backupName
|
|
||||||
if os.path.isfile(filePath):
|
|
||||||
os.remove(filePath)
|
|
||||||
self.builder.get_object("mainMenu").popdown()
|
|
||||||
self.utilsClass.refereshDirectoryList()
|
|
||||||
except Exception as e:
|
|
||||||
print(str(e))
|
|
||||||
|
|
||||||
|
|
||||||
def resetName(self, widget, data=None):
|
|
||||||
self.fileNameEntry.set_text(self.backupName)
|
|
||||||
|
|
||||||
def setBackupVar(self, widget):
|
|
||||||
self.backupName = self.fileNameEntry.get_text()
|
|
|
@ -1,3 +0,0 @@
|
||||||
from .MainWindow import MainWindow
|
|
||||||
from .DrawingArea import DrawingArea
|
|
||||||
from .MainMenuPopup import MainMenuPopup
|
|
|
@ -1,96 +0,0 @@
|
||||||
# Python imports
|
|
||||||
import os, threading, time, datetime
|
|
||||||
|
|
||||||
# Lib imports
|
|
||||||
from gi.repository import GLib
|
|
||||||
import pyscreenshot as capture
|
|
||||||
|
|
||||||
|
|
||||||
# Application imports
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
class CrossClassSignals:
|
|
||||||
def __init__(self, settings):
|
|
||||||
self.settings = settings
|
|
||||||
self.builder = self.settings.returnBuilder()
|
|
||||||
self.SCREENSHOTS_DIR = self.settings.returnScreenshotsDir()
|
|
||||||
self.fileStore = self.builder.get_object("fileStore")
|
|
||||||
self.refreshingState = False
|
|
||||||
|
|
||||||
|
|
||||||
def returnRefreshingState(self):
|
|
||||||
return self.refreshingState
|
|
||||||
|
|
||||||
def setRefreshingState(self, state):
|
|
||||||
self.refreshingState = state
|
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
|
||||||
def refereshDirectoryList(self):
|
|
||||||
self.refreshingState = True
|
|
||||||
images = self.returnDirectoryList()
|
|
||||||
images.sort()
|
|
||||||
if len(images) != len(self.fileStore):
|
|
||||||
self.fileStore.clear()
|
|
||||||
for image in images:
|
|
||||||
GLib.idle_add(self.addToStore, (image))
|
|
||||||
|
|
||||||
# self.fileStore.sort()
|
|
||||||
self.refreshingState = False
|
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
|
||||||
def addToStore(self, image):
|
|
||||||
self.fileStore.append([image])
|
|
||||||
|
|
||||||
def returnDirectoryList(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 boundingBoxGrab(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.generateScreenshotName())
|
|
||||||
|
|
||||||
def generateScreenshotName(self):
|
|
||||||
return self.SCREENSHOTS_DIR + '/scrshot_' + self.getTime() + '.png'
|
|
||||||
|
|
||||||
def getTime(self):
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
return now.strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
|
|
||||||
def sleep(self, wait=None):
|
|
||||||
delayAmount = self.builder.get_object("delayAmount")
|
|
||||||
if not wait:
|
|
||||||
wait = delayAmount.get_value_as_int()
|
|
||||||
|
|
||||||
time.sleep(wait)
|
|
||||||
|
|
||||||
|
|
||||||
def getClipboardData(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 setClipboardData(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,2 +1,3 @@
|
||||||
from .Settings import Settings
|
"""
|
||||||
from .CrossClassSignals import CrossClassSignals
|
Utils module
|
||||||
|
"""
|
||||||
|
|
|
@ -43,14 +43,14 @@ class Settings:
|
||||||
self.builder.add_from_file(self._GLADE_FILE)
|
self.builder.add_from_file(self._GLADE_FILE)
|
||||||
|
|
||||||
|
|
||||||
def createWindow(self):
|
def create_window(self):
|
||||||
# Get window and connect signals
|
# Get window and connect signals
|
||||||
window = self.builder.get_object("Main_Window")
|
window = self.builder.get_object("Main_Window")
|
||||||
window.connect("delete-event", Gtk.main_quit)
|
window.connect("delete-event", Gtk.main_quit)
|
||||||
self.setWindowData(window)
|
self.set_window_data(window)
|
||||||
return window
|
return window
|
||||||
|
|
||||||
def setWindowData(self, window):
|
def set_window_data(self, window):
|
||||||
screen = window.get_screen()
|
screen = window.get_screen()
|
||||||
visual = screen.get_rgba_visual()
|
visual = screen.get_rgba_visual()
|
||||||
|
|
||||||
|
@ -58,13 +58,13 @@ class Settings:
|
||||||
window.set_visual(visual)
|
window.set_visual(visual)
|
||||||
|
|
||||||
# bind css file
|
# bind css file
|
||||||
cssProvider = Gtk.CssProvider()
|
css_provider = Gtk.CssProvider()
|
||||||
cssProvider.load_from_path(self._CSS_FILE)
|
css_provider.load_from_path(self._CSS_FILE)
|
||||||
screen = Gdk.Screen.get_default()
|
screen = Gdk.Screen.get_default()
|
||||||
styleContext = Gtk.StyleContext()
|
style_context = Gtk.StyleContext()
|
||||||
styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||||
|
|
||||||
def getMonitorData(self):
|
def get_monitor_data(self):
|
||||||
screen = self.builder.get_object("Main_Window").get_screen()
|
screen = self.builder.get_object("Main_Window").get_screen()
|
||||||
wdth = screen.get_width()
|
wdth = screen.get_width()
|
||||||
hght = screen.get_height()
|
hght = screen.get_height()
|
||||||
|
@ -80,8 +80,8 @@ class Settings:
|
||||||
return monitors
|
return monitors
|
||||||
|
|
||||||
|
|
||||||
def returnBuilder(self): return self.builder
|
def get_builder(self): return self.builder
|
||||||
def returnScreenshotsDir(self): return self.SCREENSHOTS_DIR
|
def get_screenshots_dir(self): return self.SCREENSHOTS_DIR
|
||||||
|
|
||||||
# Filter returns
|
# Filter returns
|
||||||
def returnImagesFilter(self): return self.images
|
def get_images_filter(self): return self.images
|
|
@ -0,0 +1,92 @@
|
||||||
|
# Python imports
|
||||||
|
import os, time, datetime
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
from gi.repository import GLib
|
||||||
|
import pyscreenshot as capture
|
||||||
|
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Utils:
|
||||||
|
def __init__(self, _settings):
|
||||||
|
self.settings = _settings
|
||||||
|
self.builder = self.settings.get_builder()
|
||||||
|
|
||||||
|
self.SCREENSHOTS_DIR = self.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.file_store.sort()
|
||||||
|
self.refreshing_state = False
|
||||||
|
|
||||||
|
|
||||||
|
@threaded
|
||||||
|
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 setClipboardData(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()
|
|
@ -67,7 +67,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">grabRegionImage</property>
|
<property name="image">grabRegionImage</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="grabRegion" swapped="no"/>
|
<signal name="clicked" handler="grab_region" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="use-stock">True</property>
|
<property name="use-stock">True</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="returnToMainWindow" swapped="no"/>
|
<signal name="clicked" handler="go_to_main_window" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
<property name="margin-bottom">5</property>
|
<property name="margin-bottom">5</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw-indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
<signal name="toggled" handler="toggleRadioBttn" swapped="no"/>
|
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -189,7 +189,7 @@
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw-indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
<property name="group">entireScrnToggle</property>
|
<property name="group">entireScrnToggle</property>
|
||||||
<signal name="toggled" handler="toggleRadioBttn" swapped="no"/>
|
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw-indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
<property name="group">entireScrnToggle</property>
|
<property name="group">entireScrnToggle</property>
|
||||||
<signal name="toggled" handler="toggleRadioBttn" swapped="no"/>
|
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<property name="draw-indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
<property name="group">entireScrnToggle</property>
|
<property name="group">entireScrnToggle</property>
|
||||||
<signal name="toggled" handler="toggleRadioBttn" swapped="no"/>
|
<signal name="toggled" handler="toggle_radio_bttn" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -400,10 +400,10 @@
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="model">fileStore</property>
|
<property name="model">fileStore</property>
|
||||||
<property name="headers-clickable">False</property>
|
<property name="headers-clickable">False</property>
|
||||||
<signal name="button-press-event" handler="showMainMenu" swapped="no"/>
|
<signal name="button-press-event" handler="show_main_menu" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection">
|
<object class="GtkTreeSelection">
|
||||||
<signal name="changed" handler="setImage" swapped="no"/>
|
<signal name="changed" handler="set_image" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -459,7 +459,7 @@
|
||||||
<property name="height-request">150</property>
|
<property name="height-request">150</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="relative-to">popup_bind_area</property>
|
<property name="relative-to">popup_bind_area</property>
|
||||||
<signal name="grab-focus" handler="setBackupVar" swapped="no"/>
|
<signal name="grab-focus" handler="set_backup_var" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -489,7 +489,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">revertImage</property>
|
<property name="image">revertImage</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="resetName" swapped="no"/>
|
<signal name="clicked" handler="reset_name" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">renameImage</property>
|
<property name="image">renameImage</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="renameFile" swapped="no"/>
|
<signal name="clicked" handler="rename_file" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -528,7 +528,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="use-stock">True</property>
|
<property name="use-stock">True</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="openFile" swapped="no"/>
|
<signal name="clicked" handler="open_file" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -544,7 +544,7 @@
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="use-stock">True</property>
|
<property name="use-stock">True</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="clicked" handler="deleteFile" swapped="no"/>
|
<signal name="clicked" handler="delete_file" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
Loading…
Reference in New Issue