Permalink
Browse files

Fix #64 and other GTK3 bugs (still seems to have some serious single-…

…window-socket and settings-saving-loading issues)
  • Loading branch information...
1 parent 588c353 commit a2620c6589dbba8cadd78ebd12700c4c4c38b2e5 lb1programmer committed with Jan 27, 2013
Showing with 37 additions and 36 deletions.
  1. +5 −4 src/common.py
  2. +6 −5 src/configbox.py
  3. +4 −4 src/downloadbox.py
  4. +7 −7 src/downloader.py
  5. +15 −16 src/firstsetup.py
View
9 src/common.py
@@ -159,10 +159,11 @@ def start(program, arg):
logging.debug("Execution of %s completed." % program)
except Exception as e:
logging.info(str(e))
- msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE,
- "Error starting %s\n%s" % (program, e))
+ msg = gtk.MessageDialog(None,
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.ERROR,
+ gtk.ButtonsType.CLOSE,
+ "Error starting %s\n%s" % (program, e))
msg.run()
msg.destroy()
View
11 src/configbox.py
@@ -246,7 +246,8 @@ def save_settings(self):
self.downloadfolder = DOWNLOADS_DIR
self.defaultcommand = self.combo.get_active()
self.notifyseconds = int(self.notifyEntry.get_text())
- self.podcastprog = self.podcastprogbox.get_child().get_text()
+ #TODO: fix:
+ #self.podcastprog = self.podcastprogbox.get_child().get_text()
try:
self.iconsizeN = int(self.iconsize.get_text())
self.imagesizeN = int(self.imagesize.get_text())
@@ -401,9 +402,9 @@ def setOtherDefault(self, obj):
err += setup.setdefaultprotocol("itpc", self.setOtherProg.get_text())
if err:
msg = gtk.MessageDialog(self.window,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE,
- "Unable to set defaults.")
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.ERROR,
+ gtk.ButtonsType.CLOSE,
+ "Unable to set defaults.")
msg.run()
msg.destroy()
View
8 src/downloadbox.py
@@ -107,17 +107,17 @@ def downloadNotify(self):
self.lastCompleteDownloads != self.downloaded):
self.lastCompleteDownloads = self.downloaded
try:
- import pynotify
+ from gi.repository import Notify
if self.total == 1:
s = ""
else:
s = "s"
- pynotify.init("TunesViewer")
- n = pynotify.Notification("Download%s Finished" % s,
+ Notify.init("TunesViewer")
+ n = Notify.Notification.new("Download%s Finished" % s,
"%s/%s download%s completed successfully." % (self.downloaded, self.total, s), gtk.STOCK_GO_DOWN)
n.set_timeout(1000 * self.Wopener.config.notifyseconds)
n.show()
- except (ImportError, gio.Error, glib.GError) as e:
+ except (ImportError, glib.GError) as e:
logging.warn("Notification failed: " + str(e))
def newDownload(self, icon, url, localfile, opener):
View
14 src/downloader.py
@@ -175,9 +175,9 @@ def actionSelect(self, obj):
subprocess.Popen(["soundconverter", self.localfile])
except OSError:
msg = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE,
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.ERROR,
+ gtk.ButtonsType.CLOSE,
"Soundconverter not found, try installing it with your package manager.")
msg.run()
msg.destroy()
@@ -311,13 +311,13 @@ def downloadThread(self):
def deletefile(self):
filesize = os.path.getsize(self.localfile)
msg = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_QUESTION,
- gtk.BUTTONS_YES_NO,
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.QUESTION,
+ gtk.ButtonsType.YES_NO,
"Are you sure you want to delete this %s file?\n%s" % (desc(filesize), self.localfile))
answer = msg.run()
msg.destroy()
- if answer == gtk.RESPONSE_YES:
+ if answer == gtk.ResponseType.YES:
logging.debug("deleting...")
self.cancel(None)
else:
View
31 src/firstsetup.py
@@ -34,18 +34,17 @@ def run():
logging.error("Run this as user, not root.")
return
-
msg = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_QUESTION,
- gtk.BUTTONS_YES_NO,
- "Do you want to enable opening "
- "university media directly from the "
- "web browser?")
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.QUESTION,
+ gtk.ButtonsType.YES_NO,
+ "Do you want to enable opening "
+ "university media directly from the "
+ "web browser?")
r = msg.run()
msg.destroy()
- if r == gtk.RESPONSE_YES:
+ if r == gtk.ResponseType.YES:
logging.info("Setting default...")
setdefault()
@@ -56,10 +55,10 @@ def setdefault():
file(TV_PATH)
except IOError:
msg = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE,
- "The link %s does not exist." % TV_PATH)
+ gtk.DialogFlags.MODAL,
+ gtk.MessageType.ERROR,
+ gtk.ButtonsType.CLOSE,
+ "The link %s does not exist." % TV_PATH)
msg.run()
msg.destroy()
return
@@ -74,18 +73,18 @@ def setdefault():
err += setdefaultprotocol("itpc", tv_call)
if err:
- message_type = gtk.MESSAGE_ERROR
+ message_type = gtk.MessageType.ERROR
message = "Unable to set defaults."
else:
- message_type = gtk.MESSAGE_INFO
+ message_type = gtk.MessageType.INFO
message = ("Default set. Now you should be able to "
"open iTunesU from a web browser.")
msg = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
+ gtk.DialogFlags.MODAL,
message_type,
- gtk.BUTTONS_CLOSE,
+ gtk.ButtonsType.CLOSE,
message)
msg.run()
msg.destroy()

0 comments on commit a2620c6

Please sign in to comment.