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 0000000..bf79925 Binary files /dev/null and b/config/sunflower/user_plugins/__pycache__/__init__.cpython-37.pyc differ 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 0000000..4b37f01 Binary files /dev/null and b/config/sunflower/user_plugins/archiver/__pycache__/__init__.cpython-37.pyc differ 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 0000000..d895718 Binary files /dev/null and b/config/sunflower/user_plugins/image-manipulation/__pycache__/__init__.cpython-37.pyc differ diff --git a/config/sunflower/user_plugins/image-manipulation/plugin.conf b/config/sunflower/user_plugins/image-manipulation/plugin.conf new file mode 100644 index 0000000..b8a4de5 --- /dev/null +++ b/config/sunflower/user_plugins/image-manipulation/plugin.conf @@ -0,0 +1,14 @@ +[Name] +en=Image manipulation + +[Description] +en= + +[Version] +number=0.1 + +[Author] +name=Arseniy Krasnov +contact=arseniy@krasnoff.org +site= + diff --git a/config/sunflower/user_plugins/image-manipulation/plugin.py b/config/sunflower/user_plugins/image-manipulation/plugin.py new file mode 100644 index 0000000..acfffd7 --- /dev/null +++ b/config/sunflower/user_plugins/image-manipulation/plugin.py @@ -0,0 +1,135 @@ +import os +import Image + +class ImageManipulation(): + + def __init__(self, main_window) : + self.main_window = main_window + self.mimes = ('image/png', 'image/jpeg', 'image/gif','image/bmp','image/tiff', ) + self.items = ( + { + 'label': 'Image manipulation', + 'submenu': + ( + { + 'label':'Resize 25%', + 'data': 25, + 'callback': self.resize, + }, + { + 'label':'Resize 50%', + 'data': 50, + 'callback': self.resize, + }, + { + 'label':'Resize 75%', + 'data': 75, + 'callback': self.resize, + }, + { + 'type': 'separator', + }, + { + 'label': 'Rotate 90', + 'data': Image.ROTATE_90, + 'callback': self.transpose, + }, + { + 'label': 'Rotate 180', + 'data': Image.ROTATE_180, + 'callback': self.transpose, + }, + { + 'label': 'Rotate 270', + 'data': Image.ROTATE_270, + 'callback': self.transpose, + }, + { + 'label': 'Flip left to rigth', + 'data': Image.FLIP_LEFT_RIGHT, + 'callback': self.transpose, + }, + { + 'label': 'Flip top to bottom', + 'data': Image.FLIP_TOP_BOTTOM, + 'callback': self.transpose, + }, + { + 'type': 'separator', + }, + { + 'label': 'Convert', + 'submenu': + ( + { + 'label': 'PNG', + 'data': 'png', + 'callback': self.convert, + }, + { + 'label': 'JPEG', + 'data': 'JPEG', + 'callback': self.convert, + }, + { + 'label': 'BMP', + 'data': 'bmp', + 'callback': self.convert, + }, + { + 'label': 'TIFF', + 'data': 'tiff', + 'callback': self.convert, + }, + { + 'label': 'GIF', + 'data': 'gif', + 'callback': self.convert, + }, + ) + } + + ) + }, + ) + + def get_selection_mimes(self): + + selections = self.main_window.get_active_object()._get_selection_list() + is_subset = lambda x:self.main_window.associations_manager.get_mime_type(x) in self.mimes + result = filter(is_subset, selections) + return result + + def resize(self, widget, percent): + for image in self.get_selection_mimes(): + try: + im = Image.open(image) + w,h = im.size + im.resize(((percent*w)/100,(percent*h)/100), Image.ANTIALIAS).save(image) + except IOError: + print "cannot resize", image + + + def transpose(self, widget, method): + for image in self.get_selection_mimes(): + try: + im = Image.open(image) + im.transpose(method).save(image) + except IOError: + print "cannot rotate", image + + def convert(self, widget, format): + for image in self.get_selection_mimes(): + try: + im = Image.open(image) + file_name = '{0}.{1}'.format(os.path.splitext(image)[0], format) + im.save(file_name, format=format) + except IOError: + print "cannot convert", image + + +def register_plugin(application): + + im = ImageManipulation(application) + for item in im.items: + application.register_popup_menu_action(im.mimes, application.menu_manager.create_menu_item(item)) diff --git a/config/sunflower/windows.json b/config/sunflower/windows.json index 2fcbebf..9cbf545 100644 --- a/config/sunflower/windows.json +++ b/config/sunflower/windows.json @@ -2,7 +2,7 @@ "main": { "geometry": [ 1906, - 989 + 977 ], "handle_position": 953, "hide_on_close": false,