Skip to content

Commit

Permalink
Various windows compatibility fixes.
Browse files Browse the repository at this point in the history
Tangentally relates to issue #15.
  • Loading branch information
Aeva committed Jan 1, 2017
1 parent 9b1525a commit 97bc795
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions converter_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from threading import Thread
from multiprocessing import Pool, cpu_count
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GLib, Gtk, Gdk, GObject
from nw2png import convert_to_png
from nw2tiled import convert_to_tmx
Expand Down Expand Up @@ -90,6 +91,9 @@ def setup_filters(self):
img_filter = Gtk.FileFilter()
img_filter.set_name("Image files")
img_filter.add_mime_type("image/*")
img_filter.add_pattern("*.png")
img_filter.add_pattern("*.gif")

pics_chooser = self.builder.get_object("pics1_chooser")
pics_chooser.add_filter(img_filter)

Expand Down Expand Up @@ -121,11 +125,15 @@ def refresh_levels_view(self):

self.levels_store.clear()

if not all_paths:
return

if len(all_paths) == 1:
# don't bother with nesting
for path, level in all_levels:
self.levels_store.append(None, [doc_icon, level])
else:
import pdb; pdb.set_trace()
common_path = self.find_common_path(all_paths)
path_iters = {}
for path, level in all_levels:
Expand Down Expand Up @@ -230,10 +238,10 @@ def clear_levels(self, *args, **kargs):

def file_drop_event(self, widget, drag_context, x, y, data, info, time):
uris = data.get_uris()
prefix = "file://"
prefix = r'^file:///([A-Z]:/){0,1}'
for uri in uris:
if uri.startswith(prefix):
path = uri[len(prefix):]
if re.match(prefix, uri):
path = re.sub(prefix, '/', uri)
self.add_level(path)
self.refresh_levels_view()

Expand Down

0 comments on commit 97bc795

Please sign in to comment.