Skip to content

Commit

Permalink
Merge pull request #98 from deviantfero/select-multiple-files
Browse files Browse the repository at this point in the history
Select multiple files
  • Loading branch information
deviantfero authored Jun 5, 2018
2 parents 181c1f0 + 9cbb356 commit 286e1ef
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions wpgtk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
wpgtk: An easy to use, colorscheme generator and wallpaper manager.
"""
from .data.config import __version__
from . import data
from . import gui
from . import misc

__all__ = [
"data",
"gui",
"misc",
"__version__",
]
3 changes: 2 additions & 1 deletion wpgtk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pywal
import logging
import argparse
import glob
from os import path
from subprocess import Popen
from .data import files
Expand Down Expand Up @@ -186,7 +187,7 @@ def process_args(args):
if args.a:
add_action = files.add_template if args.x \
else themer.create_theme
any(add_action(x) for x in args.a)
any(add_action(glob.glob(x)[0]) for x in args.a)
exit(0)

if args.c:
Expand Down
2 changes: 1 addition & 1 deletion wpgtk/data/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def prepare_colors(cdic):
print(config.wpgtk.getint('active'))
bc = cl[config.wpgtk.getint('active')]
else:
bc = cl[randint(0, 15)]
bc = cl[randint(9, 14)]

wpcol['COLORACT'], wpcol['COLORIN'] = split_active(bc, is_dark_theme(cl))
cdic['icons'] = prepare_icon_colors(cdic)
Expand Down
9 changes: 5 additions & 4 deletions wpgtk/gui/template_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,18 @@ def on_add_clicked(self, widget):
Gtk.STOCK_OPEN,
Gtk.ResponseType.OK))
filefilter = Gtk.FileFilter()
filechooser.set_select_multiple(True)
filefilter.set_name("Text")
filefilter.add_mime_type("text/*")
filechooser.add_filter(filefilter)
response = filechooser.run()

if response == Gtk.ResponseType.OK:
filepath = filechooser.get_filename()
files.add_template(filepath)
self.item_names = [filen for filen in
for f in filechooser.get_filenames():
files.add_template(f)
self.item_names = [f for f in
files.get_file_list(config.OPT_DIR, False)
if '.base' in filen]
if '.base' in f]
self.liststore = Gtk.ListStore(Pixbuf, str)
for filen in self.item_names:
pixbuf = Gtk.IconTheme.get_default().load_icon(icon, 64, 0)
Expand Down
4 changes: 3 additions & 1 deletion wpgtk/gui/theme_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def on_add_clicked(self, widget):
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))

filechooser.set_select_multiple(True)
filefilter = Gtk.FileFilter()
filefilter.set_name("Images")
filefilter.add_mime_type("image/png")
Expand All @@ -117,7 +118,8 @@ def on_add_clicked(self, widget):
response = filechooser.run()

if response == Gtk.ResponseType.OK:
themer.create_theme(filechooser.get_filename())
for f in filechooser.get_filenames():
themer.create_theme(f)
option_list = Gtk.ListStore(str)
for elem in list(files.get_file_list()):
option_list.append([elem])
Expand Down

0 comments on commit 286e1ef

Please sign in to comment.