Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Podshot committed Dec 28, 2014
2 parents 5be0e42 + 764cb4d commit 4ad3241
Show file tree
Hide file tree
Showing 7 changed files with 3,501 additions and 2,984 deletions.
10 changes: 8 additions & 2 deletions albow/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ def run_modal(self, modal_widget):

while modal_widget.modal_result is None:
try:

if not self.mcedit.version_checked:
if not self.mcedit.version_lock.locked():
self.mcedit.version_checked = True
self.mcedit.check_for_version()

self.hover_widget = self.find_widget(pygame.mouse.get_pos())
if self.bonus_draw_time < 1:
self.bonus_draw_time += 1
Expand Down Expand Up @@ -366,15 +372,15 @@ def run_modal(self, modal_widget):
set_modifier(key, False)
add_modifiers(event)
self.bonus_draw_time = 0

keyname = event.dict.get('keyname', None) or self.getKey(event)
levelExist = self.editor.level is not None
if 'mouse' not in keyname and 'Mouse' not in keyname:
tempKeyname = self.getKey(event, True)
for i, key in enumerate(self.editor.movements):
if tempKeyname == key:
self.changeMovementKeys(i, False, levelExist)

for i, key in enumerate(self.editor.cameraPan):
if tempKeyname == key:
self.changeCameraKeys(i, False, levelExist)
Expand Down
18 changes: 13 additions & 5 deletions mcedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,12 @@ def justQuit(self):
raise SystemExit

@classmethod
def fetch_version(self):
with self.version_lock:
self.version_info = release.fetch_new_version_info()

def check_for_version(self):
new_version = release.check_for_new_version()
new_version = release.check_for_new_version(self.version_info)
if new_version is not False:
answer = albow.ask(
_('Version {} is available').format(new_version["tag_name"]),
Expand Down Expand Up @@ -450,9 +454,13 @@ def main(self):
if mcedit.droppedLevel:
mcedit.loadFile(mcedit.droppedLevel)

new_version_thread = threading.Thread(target=self.check_for_version)
new_version_thread.start()

self.version_lock = threading.Lock()
self.version_info = None
self.version_checked = False

fetch_version_thread = threading.Thread(target=self.fetch_version)
fetch_version_thread.start()


# Disabled old update code
# if hasattr(sys, 'frozen'):
Expand Down Expand Up @@ -590,7 +598,7 @@ def saveWindowPosition(self):
dis = mcplatform.Xlib.display.Display()
win = dis.create_resource_object('window', win)
curDesk = os.environ.get('XDG_CURRENT_DESKTOP')
if curDesk == 'GNOME':
if curDesk in ('GNOME', 'X-Cinnamon'):
wParent = win.query_tree().parent.query_tree().parent
elif curDesk == 'KDE':
wParent = win.query_tree().parent.query_tree().parent.query_tree().parent
Expand Down
18 changes: 16 additions & 2 deletions mcedit.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/bin/sh
#!/bin/bash
cd $(dirname $0)
echo "Starting MCEdit..."
python2 mcedit.py
f=
if [ -f "mcedit.py" ]
then
f="mcedit.py"
elif [ -f "mcedit.pyc" ]
then
f="mcedit.pyc"
else
echo "MCEdit program not found."
echo "Check your installation and retry."
exit 1
fi
python2 "$f $@"
read -n 1 -p "Press any key to close."
echo ""
Loading

0 comments on commit 4ad3241

Please sign in to comment.