Skip to content

Commit

Permalink
Merge pull request #6 from tfuxu/nautilus-43
Browse files Browse the repository at this point in the history
  • Loading branch information
tfuxu authored Nov 2, 2022
2 parents 15f3fde + 9efcc7b commit bc2856e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 40 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ nautilus -q
The following packages are required to build win32-details:

* **Python** >= 3.6,
* Probably a recent version of **Nautilus 3.x**, or **Nautilus <= 42.x**,
* A recent version of **Nautilus >= 43.x**,
* [nautilus-python](https://wiki.gnome.org/Projects/NautilusPython),
* Copy of [exiftool](https://github.com/exiftool/exiftool) (required by PyExifTool),
* [PyExifTool](https://pypi.org/project/PyExifTool/)
Expand Down Expand Up @@ -87,17 +87,29 @@ Close currently opened Nautilus instances to load the extension:
nautilus -q
```

## Note about Nautilus versions below 43.x
Support for older Nautilus versions has been removed in win32-details 0.5.0, because of moving to Nautilus API 4.0, which deprecates direct usage of GTK widgets in favor of a new model-based interface (which is a shitty decision IMO). In this situation I had three options:
- Maintain both versions of extension, one for Nautilus 43 and above, and one for Nautilus <= 42,
- Make this extension as a standalone program, and use extension to launch it,
- Just deprecate support for older Nautilus versions.

Honestly, I'm not that interested in maintaining a seperate version of extension, as majority of people are using the latest version of Nautilus now. Moving a extension to a standalone program would make everything more complicated, and I don't think that many people would want to install an app which just shows them details of EXE files (but maybe, in the [future](https://github.com/tfuxu/win32-details/issues/5)...).

## License
<p>
<img src="https://www.gnu.org/graphics/gplv3-with-text-136x68.png" alt="GPLv3 logo" align="right">
This repository is licensed under the terms of the GNU GPLv3 license. You can find a copy of the license in the LICENSE file.
</p>

## Changelog
* **0.4:**
* **0.5.0:**
* Port extension to Nautilus API 4.0, **from this version onward, win32-details won't support Nautilus versions below 43**[ (more info)](#note-about-nautilus-versions-below-43x)
* Add new Meson build option
* Change page name to `More Properties`
* **0.4.0:**
* Add a `MD5 Hash` row
* Allow user to copy values from rows (if row is selected, click left one time to select text)
* Add setup.py for packaging to PyPI
* Create a small CLI tool for easier installing (based on [Nautilus Terminal](https://github.com/flozz/nautilus-terminal/blob/master/nautilus_terminal/__main__.py))
* **0.1:**
* **0.1.0:**
* Initial release of Win32 Details
9 changes: 6 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('win32-details',
version: '0.4',
version: '0.5.0',
meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2',
'werror=false',
Expand All @@ -13,15 +13,18 @@ python = import('python')
EXTENSIONS_DIR = join_paths(get_option('prefix'), get_option('datadir'), 'nautilus-python/extensions')

dependency('glib-2.0')
dependency('gtk+-3.0')
dependency('pygobject-3.0', version: '>= 3.40.0')
dependency('gtk4')
dependency('pygobject-3.0', version: '>= 3.42.0')

# Check if python3 is installed
PY_INSTALLDIR = python.find_installation('python3', required: true)

# Check if exiftool is installed
find_program('exiftool', required: true)

# Check if Nautilus 43 is installed
find_program('nautilus', version: '>= 43.0', required: true)

# Install configuration data
conf = configuration_data()
conf.set('EXTENSIONS_DIR', EXTENSIONS_DIR)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
setup(
name="win32-details",
license="GPL-3.0",
version="0.4.0",
version="0.5.0",
author="tfuxu",
description=".exe file details for your Nautilus file browser",
long_description=long_desc,
Expand Down
2 changes: 1 addition & 1 deletion win32_details/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later


VERSION = "0.4.0"
VERSION = "0.5.0"
50 changes: 18 additions & 32 deletions win32_details/win32_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from urllib.parse import unquote

from gi.repository import Nautilus, Gtk, GObject
from gi.repository import GObject, Gio, Nautilus, GLib


details_list = [
Expand Down Expand Up @@ -40,13 +40,17 @@
]


class DetailsPropPage(Nautilus.PropertyPageProvider, GObject.GObject):
class MorePropsModel(Nautilus.PropertiesModelProvider, GObject.GObject):
def __init__(self):
pass

def get_property_pages(self, files):
def log_warn(self, message):
GLib.log_variant(None, GLib.LogLevelFlags.LEVEL_DEBUG, GLib.Variant("a{sv}", {"MESSAGE": message}))

def get_models(self, files):
# Check if its just a one file, or couple of files
if len(files) != 1:
self.log_warn(GLib.Variant("s", "FILES INVASION!!!1"))
return

# File path in its URI form
Expand Down Expand Up @@ -81,41 +85,23 @@ def get_property_pages(self, files):
manifest.pop("SourceFile")
for meta, data in manifest.items():
for i, mtags in zip(range(len(tags)), tags):
#print(meta == mtags)
if meta == mtags:
details_list[i][1] = data.strip()
else:
continue
details_list[-1][1] = md5sum


# Setup title for page
self.page_title = Gtk.Label("Details")
self.page_title.show()
# Setup ListStore for Nautilus.PropertiesModel content model
self.contentstore = Gio.ListStore.new(item_type=Nautilus.PropertiesItem)
for details_ref in details_list:
list_item = Nautilus.PropertiesItem(
name = details_ref[0],
value = details_ref[1]
)
self.contentstore.append(list_item)

# Setup main vertical box
self.vbox = Gtk.VBox(homogeneous=False)
self.vbox.show()

# Setup ListStore for TreeView
self.tree_liststore = Gtk.ListStore(str, str)
for details_ref in details_list:
self.tree_liststore.append(list(details_ref))

# Setup details TreeView
self.treeview = Gtk.TreeView(model=self.tree_liststore)
self.treeview.set_hover_selection(True)
for i, column_title in enumerate(["Property", "Value"]):
renderer = Gtk.CellRendererText()
if column_title == "Value":
renderer.set_property("editable", True)
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
self.treeview.append_column(column)
self.treeview.show()
self.vbox.pack_start(self.treeview, False, False, 0)


# Return to API handler as Nautilus.PropertyPage object
return Nautilus.PropertyPage(name="win32-details-page",
label=self.page_title,
page=self.vbox),
# Return to API handler as Nautilus.PropertiesModel object
return Nautilus.PropertiesModel(title="More Properties",
model=self.contentstore),

0 comments on commit bc2856e

Please sign in to comment.