From a4ddfd00361f3afd404df7c5f586d4bf61751ff0 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Sun, 7 Jun 2020 11:07:12 +0200 Subject: [PATCH] Updated sunflower --- config/sunflower/accelerators.json | 4 + config/sunflower/config.json | 12 +- config/sunflower/plugins.json | 2 +- config/sunflower/tabs.json | 11 +- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 143 bytes .../user_plugins/archiver/__init__.py | 1 + .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 152 bytes .../user_plugins/archiver/plugin.conf | 14 ++ .../sunflower/user_plugins/archiver/plugin.py | 97 +++++++++++++ .../image-manipulation/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 162 bytes .../image-manipulation/plugin.conf | 14 ++ .../user_plugins/image-manipulation/plugin.py | 135 ++++++++++++++++++ config/sunflower/windows.json | 2 +- 14 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 config/sunflower/user_plugins/__pycache__/__init__.cpython-37.pyc create mode 100644 config/sunflower/user_plugins/archiver/__init__.py create mode 100644 config/sunflower/user_plugins/archiver/__pycache__/__init__.cpython-37.pyc create mode 100644 config/sunflower/user_plugins/archiver/plugin.conf create mode 100644 config/sunflower/user_plugins/archiver/plugin.py create mode 100644 config/sunflower/user_plugins/image-manipulation/__init__.py create mode 100644 config/sunflower/user_plugins/image-manipulation/__pycache__/__init__.cpython-37.pyc create mode 100644 config/sunflower/user_plugins/image-manipulation/plugin.conf create mode 100644 config/sunflower/user_plugins/image-manipulation/plugin.py diff --git a/config/sunflower/accelerators.json b/config/sunflower/accelerators.json index 4124ed3..b1b8b01 100644 --- a/config/sunflower/accelerators.json +++ b/config/sunflower/accelerators.json @@ -178,5 +178,9 @@ "next_tab_2": "", "previous_tab": "Tab", "previous_tab_2": "" + }, + "sessions": { + "show_list": "s", + "show_list_2": "" } } \ No newline at end of file diff --git a/config/sunflower/config.json b/config/sunflower/config.json index aa6485c..6dbec58 100644 --- a/config/sunflower/config.json +++ b/config/sunflower/config.json @@ -61,10 +61,18 @@ }, "plugins": [ "system_terminal", + "sessions", + "rename_extensions", + "owner_column", + "gvim_viewer", + "find_file_extensions", "file_list", - "default_toolbar" + "default_toolbar", + "archive_support", + "image-manipulation", + "archiver" ], - "show_command_bar": false, + "show_command_bar": true, "show_notifications": true, "show_status_bar": 0, "show_titlebar": true, diff --git a/config/sunflower/plugins.json b/config/sunflower/plugins.json index 22b49e0..e6a4dbb 100644 --- a/config/sunflower/plugins.json +++ b/config/sunflower/plugins.json @@ -10,7 +10,7 @@ "size_date": 583, "size_extension": 50, "size_mode": 50, - "size_name": 200, + "size_name": 286, "size_size": 70 } } \ No newline at end of file diff --git a/config/sunflower/tabs.json b/config/sunflower/tabs.json index 206d576..e428654 100644 --- a/config/sunflower/tabs.json +++ b/config/sunflower/tabs.json @@ -5,7 +5,7 @@ { "class": "FileList", "lock": null, - "path": "/home/dbroqua", + "path": "/home/dbroqua/Projects/dbroqua/home", "sort_ascending": true, "sort_column": 0 } @@ -22,5 +22,14 @@ "sort_column": 0 } ] + }, + "sessions": { + "current": 0, + "list": [ + { + "locked": false, + "name": "Default" + } + ] } } \ No newline at end of file diff --git a/config/sunflower/user_plugins/__pycache__/__init__.cpython-37.pyc b/config/sunflower/user_plugins/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf79925fa6eb0e1c8ba29ec895e7d747a4aa7d2e GIT binary patch literal 143 zcmZ?b<>g`kg6+F*$ARd_AOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;!H8enx(7s(wmR zQGQ`*qP|{oeqLH;x_)tKURq9md1{en>%d_hiWdS+g+etdjpUS>&ryk0@&Ee@O9 Q{FKt1R6CG~pMjVG02eqTh5!Hn literal 0 HcmV?d00001 diff --git a/config/sunflower/user_plugins/archiver/__init__.py b/config/sunflower/user_plugins/archiver/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/config/sunflower/user_plugins/archiver/__init__.py @@ -0,0 +1 @@ + diff --git a/config/sunflower/user_plugins/archiver/__pycache__/__init__.cpython-37.pyc b/config/sunflower/user_plugins/archiver/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b37f017417672ae9759f084728941a6d65105b4 GIT binary patch literal 152 zcmZ?b<>g`k0?VMq!HhuqF^B^LAOQy;E@lA|DGb33nv8xc8Hzx{2;!Hcenx(7s(wmR zQGQ`*qP|{oeqLH;x_)tKURq9md1{en>%d_hiWdS+g+eqvE_MrIjMG(J8vFS8^* YUaz3?7Kcr4eoARhsvXGa&p^xo0Nwf}>Hq)$ literal 0 HcmV?d00001 diff --git a/config/sunflower/user_plugins/archiver/plugin.conf b/config/sunflower/user_plugins/archiver/plugin.conf new file mode 100644 index 0000000..787ef89 --- /dev/null +++ b/config/sunflower/user_plugins/archiver/plugin.conf @@ -0,0 +1,14 @@ +[Name] +en=Archiver + +[Description] +en=This plugin provides tools for create and extract archives + +[Version] +number=0.1 + +[Author] +name=Arseniy Krasnov +contact=arseniy@krasnoff.org +site= + diff --git a/config/sunflower/user_plugins/archiver/plugin.py b/config/sunflower/user_plugins/archiver/plugin.py new file mode 100644 index 0000000..670ce38 --- /dev/null +++ b/config/sunflower/user_plugins/archiver/plugin.py @@ -0,0 +1,97 @@ +import os +import gtk +import zipfile,tarfile + +class Archiver(): + + def __init__(self, main_window) : + self.main_window = main_window + self.archive_mimes = ('application/zip', 'application/x-tar', 'application/x-compressed-tar') + self.menu_mimes = ('application/octet-stream', 'inode/directory', 'text/directory', 'folder') + self.extract_menu_item = ( + { + 'label': 'Extract', + 'data': False, + 'callback': self.extract, + }, + { + 'label': 'Extract in folder', + 'data': True, + 'callback': self.extract, + }, + ) + + self.extract_menu = gtk.Menu() + for item in self.extract_menu_item: + self.extract_menu.append(self.main_window.menu_manager.create_menu_item(item)) + + + self.create_menu_item = ( + { + 'label': 'Make archive', + 'callback': self.make_archive, + }, + ) + + self.create_menu = gtk.Menu() + for item in self.create_menu_item: + self.create_menu.append(self.main_window.menu_manager.create_menu_item(item)) + + self.archiver_menu = self.main_window.menu_manager.create_menu_item( + { + 'label': 'Archiver', + 'submenu': '' + } + ) + self.archiver_menu.connect("activate", self.expand_menu) + + def expand_menu(self, data): + self.archiver_menu.set_submenu(self.create_menu) + filename = self.get_selection() + + try: + if zipfile.is_zipfile(filename) or tarfile.is_tarfile(filename): + self.archiver_menu.set_submenu(self.extract_menu) + except IOError as e: + if e.errno == 21: + pass + + def get_selection(self): + selections = self.main_window.get_active_object()._get_selection() + return selections + + def extract(self, widget, in_folder): + filepath = self.get_selection() + path = os.path.dirname(filepath) + if in_folder : + path = os.path.splitext(filepath)[0] + + try: + if zipfile.is_zipfile(filepath): + archive = zipfile.ZipFile(filepath) + elif tarfile.is_tarfile(filepath): + archive = tarfile.open(filepath) + archive.extractall(path) + archive.close() + except Exception, e : + print e + + def make_archive(self, widget, data): + filepath = self.get_selection() + zfile = filepath.rstrip('/') + '.zip' + filepath = filepath.rstrip('/') + zf = zipfile.ZipFile(zfile, mode='w') + if os.path.isfile(filepath): + zf.write(filepath, filepath[len(os.path.dirname(filepath)):].strip('/'), compress_type=zipfile.ZIP_DEFLATED) + else: + for root, dirs, files in os.walk(filepath): + for name in files: + file_to_zip = os.path.join(root, name) + arcname = file_to_zip[len(os.path.dirname(filepath)):].strip('/') + zf.write(file_to_zip, arcname, compress_type=zipfile.ZIP_DEFLATED) + + +def register_plugin(application): + archiver = Archiver(application) + application.register_popup_menu_action(archiver.menu_mimes, archiver.archiver_menu) + diff --git a/config/sunflower/user_plugins/image-manipulation/__init__.py b/config/sunflower/user_plugins/image-manipulation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/config/sunflower/user_plugins/image-manipulation/__pycache__/__init__.cpython-37.pyc b/config/sunflower/user_plugins/image-manipulation/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8957183062413739a0c7547dce1dd754a8ee37d GIT binary patch literal 162 zcmZ?b<>g`k0#26e0U-J@h=2h`Aj1KOi&=m~3PUi1CZpd