Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format follows [keepachangelog.com]. Please stick to it.
* Various fixes aimed at improving mac osx compatibility
* Avoid generating ``rmlint.sh`` or other output files for ``rmlint --dedupe`` or ``rmlint --is-reflink`
* Fix possible compile problems scons' default CC flags are non-functional
* Fix GUI failing to start with pygobject >= 3.56

### Added

Expand Down
11 changes: 3 additions & 8 deletions gui/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,15 @@ PYTHON = ARGUMENTS.get('PYTHON', 'python3')
if 'install' in COMMAND_LINE_TARGETS and GetOption('with_gui'):
python_exe = which(PYTHON)
if not python_exe:
print('!! Unable to find {} executable.'.format(PYTHON))
print(f'!! Unable to find {PYTHON} executable.')
print('!! Will build no GUI.')
else:
if GetOption('with_compile-glib-schemas'):
env['ENV']['COMPILE_GLIB_SCHEMA'] = '1'
py_install = env.Command(
'always.install',
['setup.py'],
'cd {} && {} setup.py install --prefix {} --record {}'.format(
GUI_DIR,
python_exe,
PREFIX,
FILES_RECORD
)
f'cd {GUI_DIR} && {python_exe} setup.py install --prefix {PREFIX} --record {FILES_RECORD}'
)
env.Alias('install', py_install)

Expand All @@ -62,7 +57,7 @@ if 'uninstall' in COMMAND_LINE_TARGETS and GetOption('with_gui'):
print('Unable to delete', path, ':', err)

except OSError as err:
print('Could not open {}: '.format(FILES_RECORD_FULL), err)
print(f'Could not open {FILES_RECORD_FULL}: ', err)

if not GetOption('with_compile-glib-schemas'):
return
Expand Down
14 changes: 6 additions & 8 deletions gui/setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python3
import logging
import os
import subprocess
from distutils.command.install_data import install_data

from setuptools import setup
from setuptools.command.install import install
from distutils.command.install_data import install_data

import os
import logging
import subprocess

GRESOURCE_DIR = 'shredder/resources'
GRESOURCE_FILE = 'shredder.gresource.xml'
Expand All @@ -15,7 +13,7 @@

def read_version():
vfp = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, '.version')
with open(vfp, 'r') as handle:
with open(vfp) as handle:
version_string = handle.read()

version_numbers, _ = version_string.split(' ', 1)
Expand All @@ -35,7 +33,7 @@ def _build_gresources(self):
try:
subprocess.call([
'glib-compile-resources',
'--sourcedir={}'.format(GRESOURCE_DIR),
f'--sourcedir={GRESOURCE_DIR}',
os.path.join(GRESOURCE_DIR, GRESOURCE_FILE)
])
except subprocess.CalledProcessError as err:
Expand Down
6 changes: 1 addition & 5 deletions gui/shredder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python
# encoding: utf-8

"""Common constants."""

import gi

gi.require_version('Gtk', '3.0')
gi.require_version('GdkPixbuf', '2.0')
gi.require_version('Rsvg', '2.0')
gi.require_version('PangoCairo', '1.0')
gi.require_version('GtkSource', '4')
Expand All @@ -24,10 +22,8 @@

def run_gui():
"""Fully take over and run the gui code."""
# Stdlib:
import sys

# Internal:
from shredder.cmdline import parse_arguments
from shredder.logger import create_logger

Expand Down
3 changes: 0 additions & 3 deletions gui/shredder/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# encoding: utf-8

"""Init triggering goes here.

This code will be executed first when doing:
Expand Down
18 changes: 4 additions & 14 deletions gui/shredder/about.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
#!/usr/bin/env python
# encoding: utf-8

"""Own module for the about dialog."""


# Stdlib:
import re
import logging
import re

# Internal
from shredder import APP_TITLE, APP_DESCRIPTION

# External:
from gi.repository import Gtk, Gio
from gi.repository import Gio, Gtk

from shredder import APP_DESCRIPTION, APP_TITLE

LOGGER = logging.getLogger('about')


MAIN_AUTHORS = [
'Christopher Pahl <sahib@online.de>',
'Daniel Thomas <thomas_d_j@yahoo.com.au>',
'Cebtenzzre <cebtenzzre@gmail.com>',
]


# Change when needed.
DOCUMENTERS = MAIN_AUTHORS

Expand Down Expand Up @@ -81,6 +70,7 @@ def __init__(self, app_win):
def main():
"""Show the about dialog as modal window."""
import os

from shredder.application import _load_app_icon

win = Gtk.Window()
Expand Down
31 changes: 10 additions & 21 deletions gui/shredder/application.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
#!/usr/bin/env python
# encoding: utf-8

"""Shredder's GtkApplication implementation.

It loads all initially required resources and triggers
the gui build by instancing the MainWindow.
"""

# Stdlib:
import os
import sys
import gettext
import logging
import os

# External:
from gi.repository import Gtk, Gio, Rsvg, GdkPixbuf
from gi.repository import GdkPixbuf, GLib, Gio, Gtk, Rsvg

# Internal
from shredder import APP_TITLE
from shredder.util import load_css_from_data
from shredder.about import AboutDialog
from shredder.runner import Script
from shredder.window import MainWindow

from shredder.views.settings import SettingsView
from shredder.util import load_css_from_data
from shredder.views.editor import EditorView
from shredder.views.locations import LocationView
from shredder.views.runner import RunnerView
from shredder.views.editor import EditorView

from shredder.views.settings import SettingsView
from shredder.window import MainWindow

LOGGER = logging.getLogger('application')

Expand Down Expand Up @@ -71,11 +62,13 @@ def _load_app_icon():
class Application(Gtk.Application):
"""GtkApplication implementation of Shredder."""
def __init__(self, options):
Gtk.Application.__init__(
self,
GLib.set_application_name(APP_TITLE)

super().__init__(
application_id='org.gnome.Shredder',
flags=Gio.ApplicationFlags.FLAGS_NONE
)

self.cmd_opts = options
self.settings = self.win = None

Expand Down Expand Up @@ -131,10 +124,6 @@ def do_startup(self, **kw):
self.set_accels_for_action('app.search', ['<Ctrl>F'])
self.set_accels_for_action('app.activate', ['<Ctrl>Return'])

# Set the fallback window title.
# This is only used if no .desktop file is provided.
self.win.set_wmclass(APP_TITLE, APP_TITLE)

# Load the application icon
self.win.set_default_icon(_load_app_icon())

Expand Down
22 changes: 4 additions & 18 deletions gui/shredder/chart.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
#!/usr/bin/env python
# encoding: utf-8

"""
Chart rendering code and relevant Gtk widgets.
The chart is drawn via cairo and a tiny bit of math.
"""


# Stdlib:
import math
import colorsys
import math

# Internal:
from shredder.util import size_to_human_readable
from shredder.tree import Column

# External:
import cairo
from gi.repository import Gdk, GLib, Gtk, Pango, PangoCairo

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib

from gi.repository import Pango
from gi.repository import PangoCairo

from shredder.tree import Column
from shredder.util import size_to_human_readable

ANGLE_LIMIT_TOOLTIP = math.pi / 32
ANGLE_LIMIT_VISIBLE = math.pi / 256
Expand Down
Loading
Loading