From 28cd66f816fd92c549b173d0014e0acfbc6fd1b6 Mon Sep 17 00:00:00 2001 From: TacticalGenius Date: Sat, 26 Jan 2013 13:16:07 -0600 Subject: [PATCH 1/5] file path and player path can now be selected via filechoosers --- syncplay/ui/GuiConfiguration.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 453b1ff..c2df2ef 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -20,6 +20,7 @@ class GuiConfiguration: self.window.add(vbox) vbox.show() self._addLabeledEntries(self.config, vbox) + self._addFileChoosersButtons(vbox) self._addCheckboxEntries(self.config, vbox) self.hostEntry.select_region(0, len(self.hostEntry.get_text())) button = gtk.Button(stock=gtk.STOCK_SAVE) @@ -51,7 +52,6 @@ class GuiConfiguration: self.userEntry = self._addLabeledEntryToVbox(getMessage("en", "username-label"), config['name'], vbox, lambda __, _: self._saveDataAndLeave()) self.roomEntry = self._addLabeledEntryToVbox(getMessage("en", "room-label"), config['room'], vbox, lambda __, _: self._saveDataAndLeave()) self.passEntry = self._addLabeledEntryToVbox(getMessage("en", "password-label"), config['password'], vbox, lambda __, _: self._saveDataAndLeave()) - self.mpcEntry = self._addLabeledEntryToVbox(getMessage("en", "path-label"), self._tryToFillPlayerPath(), vbox, lambda __, _: self._saveDataAndLeave()) def _tryToFillPlayerPath(self): for path in self._availablePlayerPaths: @@ -69,7 +69,6 @@ class GuiConfiguration: self.config['name'] = self.userEntry.get_text() self.config['room'] = self.roomEntry.get_text() self.config['password'] = self.passEntry.get_text() - self.config['playerPath'] = self.mpcEntry.get_text() if self.alwaysShowCheck.get_active() == True: self.config['forceGuiPrompt'] = True else: @@ -125,6 +124,33 @@ class GuiConfiguration: CheckVbox.add(self.slowOnDesyncCheck) CheckVbox.show() + def _addFileChoosersButtons(self, vbox): + hbox = gtk.HBox(False, 0) + self.playerPathButton = gtk.Button("Select Player Executable") + self.playerPathButton.connect("clicked", lambda w: self._showPlayerFileDialog()) + self.playerPathButton.show() + self.mediaPathButton = gtk.Button("Select Media File") + self.mediaPathButton.connect("clicked", lambda w: self._showMediaFileDialog()) + self.mediaPathButton.show() + hbox.add(self.playerPathButton) + hbox.add(self.mediaPathButton) + hbox.show() + vbox.add(hbox) + + def _showPlayerFileDialog(self): + dialog = gtk.FileChooserDialog(parent=self.window,action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) + dialog.run() + if dialog.get_filename() != None: + self.config['playerPath'] = dialog.get_filename() + dialog.destroy() + + def _showMediaFileDialog(self): + dialog = gtk.FileChooserDialog(parent=self.window,action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) + dialog.run() + if dialog.get_filename() != None: + self.config['file'] = dialog.get_filename() + dialog.destroy() + def setAvailablePaths(self, paths): self._availablePlayerPaths = paths From 74802daf204a446c38c9b330b521921da2dd2118 Mon Sep 17 00:00:00 2001 From: TacticalGenius Date: Sat, 26 Jan 2013 14:17:28 -0600 Subject: [PATCH 2/5] changed the link to the config guie to use webbrowser.open() --- syncplay/ui/GuiConfiguration.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index c2df2ef..a080aa2 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -3,7 +3,7 @@ import os pygtk.require('2.0') import gtk gtk.set_interactive(False) -import cairo, gio, pango, atk, pangocairo, gobject #@UnusedImport +import webbrowser from syncplay.messages import getMessage class GuiConfiguration: @@ -25,7 +25,9 @@ class GuiConfiguration: self.hostEntry.select_region(0, len(self.hostEntry.get_text())) button = gtk.Button(stock=gtk.STOCK_SAVE) button.connect("clicked", lambda w: self._saveDataAndLeave()) - guideLink = gtk.LinkButton("http://syncplay.pl/guide/", "Configuration Guide") + guideLink = gtk.Button("Configuration Guide") + guideLink.connect("clicked", lambda w: webbrowser.open("http://syncplay.pl/guide/")) + print 'e' guideLink.show() vbox.add(guideLink) vbox.pack_start(button, True, True, 0) From d956ec8d3605546f7ceba8cb9823cb86279a4914 Mon Sep 17 00:00:00 2001 From: TacticalGenius Date: Sat, 26 Jan 2013 14:40:50 -0600 Subject: [PATCH 3/5] [GUI] added text entries back and moved filechooser buttons to be beside them --- syncplay/messages.py | 3 ++- syncplay/ui/GuiConfiguration.py | 36 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/syncplay/messages.py b/syncplay/messages.py index f008e2d..74a575a 100644 --- a/syncplay/messages.py +++ b/syncplay/messages.py @@ -93,7 +93,8 @@ en = { "room-label" : 'Default room (optional): ', "password-label" : 'Server password (optional): ', "path-label" : 'Path to player executable: ', - + "file-label" : 'Path to media file: ', + # Server notifications "welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", #version "client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", #username, host, room diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index a080aa2..4a94823 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -20,14 +20,12 @@ class GuiConfiguration: self.window.add(vbox) vbox.show() self._addLabeledEntries(self.config, vbox) - self._addFileChoosersButtons(vbox) self._addCheckboxEntries(self.config, vbox) self.hostEntry.select_region(0, len(self.hostEntry.get_text())) button = gtk.Button(stock=gtk.STOCK_SAVE) button.connect("clicked", lambda w: self._saveDataAndLeave()) guideLink = gtk.Button("Configuration Guide") guideLink.connect("clicked", lambda w: webbrowser.open("http://syncplay.pl/guide/")) - print 'e' guideLink.show() vbox.add(guideLink) vbox.pack_start(button, True, True, 0) @@ -54,6 +52,8 @@ class GuiConfiguration: self.userEntry = self._addLabeledEntryToVbox(getMessage("en", "username-label"), config['name'], vbox, lambda __, _: self._saveDataAndLeave()) self.roomEntry = self._addLabeledEntryToVbox(getMessage("en", "room-label"), config['room'], vbox, lambda __, _: self._saveDataAndLeave()) self.passEntry = self._addLabeledEntryToVbox(getMessage("en", "password-label"), config['password'], vbox, lambda __, _: self._saveDataAndLeave()) + self.mpcEntry = self._addLabeledEntryToVbox(getMessage("en", "path-label"), self._tryToFillPlayerPath(), vbox, lambda __, _: self._saveDataAndLeave()) + self.fileEntry = self._addLabeledEntryToVbox(getMessage("en", "file-label"), config['file'], vbox, lambda __, w: self._saveDataAndLeave()) def _tryToFillPlayerPath(self): for path in self._availablePlayerPaths: @@ -101,7 +101,20 @@ class GuiConfiguration: if(initialEntryValue == None): initialEntryValue = "" entry.set_text(initialEntryValue) - hbox.pack_end(entry, False, False, 0) + if(label == getMessage("en", "path-label")): + self.playerPathButton = gtk.Button("Browse") + self.playerPathButton.connect("clicked", lambda w: self._showPlayerFileDialog()) + self.playerPathButton.show() + hbox.add(entry) + hbox.pack_end(self.playerPathButton, False, False, 0) + elif(label == getMessage("en", "file-label")): + self.mediaPathButton = gtk.Button("Browse") + self.mediaPathButton.connect("clicked", lambda w: self._showMediaFileDialog()) + self.mediaPathButton.show() + hbox.add(entry) + hbox.pack_end(self.mediaPathButton, False, False, 0) + else: + hbox.pack_end(entry, False, False, 0) entry.set_usize(200, -1) entry.show() return entry @@ -109,7 +122,7 @@ class GuiConfiguration: def _addCheckboxEntries(self, config, vbox): CheckVbox = gtk.VBox(False, 0) vbox.pack_start(CheckVbox, False, False, 0) - self.alwaysShowCheck = gtk.CheckButton("Always Show This Dialog") + self.alwaysShowCheck = gtk.CheckButton("Always Show This Dialog When Opening A File With Syncplay") if self.config['forceGuiPrompt'] == True: self.alwaysShowCheck.set_active(True) self.alwaysShowCheck.show() @@ -126,25 +139,13 @@ class GuiConfiguration: CheckVbox.add(self.slowOnDesyncCheck) CheckVbox.show() - def _addFileChoosersButtons(self, vbox): - hbox = gtk.HBox(False, 0) - self.playerPathButton = gtk.Button("Select Player Executable") - self.playerPathButton.connect("clicked", lambda w: self._showPlayerFileDialog()) - self.playerPathButton.show() - self.mediaPathButton = gtk.Button("Select Media File") - self.mediaPathButton.connect("clicked", lambda w: self._showMediaFileDialog()) - self.mediaPathButton.show() - hbox.add(self.playerPathButton) - hbox.add(self.mediaPathButton) - hbox.show() - vbox.add(hbox) - def _showPlayerFileDialog(self): dialog = gtk.FileChooserDialog(parent=self.window,action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) dialog.run() if dialog.get_filename() != None: self.config['playerPath'] = dialog.get_filename() dialog.destroy() + self.mpcEntry.set_text(self.config['playerPath']) def _showMediaFileDialog(self): dialog = gtk.FileChooserDialog(parent=self.window,action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) @@ -152,6 +153,7 @@ class GuiConfiguration: if dialog.get_filename() != None: self.config['file'] = dialog.get_filename() dialog.destroy() + self.fileEntry.set_text(self.config['file']) def setAvailablePaths(self, paths): self._availablePlayerPaths = paths From 98ee33b4ecdcafc21f62bf5946c48e142dd574c5 Mon Sep 17 00:00:00 2001 From: TacticalGenius Date: Sun, 27 Jan 2013 15:58:02 -0600 Subject: [PATCH 4/5] [GUI] commiting intial work on the MAL Updater settings --- syncplay/ui/GuiConfiguration.py | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 4a94823..39ca869 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -21,8 +21,10 @@ class GuiConfiguration: vbox.show() self._addLabeledEntries(self.config, vbox) self._addCheckboxEntries(self.config, vbox) + self._addMalPanel(vbox) self.hostEntry.select_region(0, len(self.hostEntry.get_text())) button = gtk.Button(stock=gtk.STOCK_SAVE) + button.set_resize_mode(gtk.RESIZE_PARENT) button.connect("clicked", lambda w: self._saveDataAndLeave()) guideLink = gtk.Button("Configuration Guide") guideLink.connect("clicked", lambda w: webbrowser.open("http://syncplay.pl/guide/")) @@ -155,6 +157,42 @@ class GuiConfiguration: dialog.destroy() self.fileEntry.set_text(self.config['file']) + def _addMalPanel(self, vbox): + panel = gtk.Expander("MAL Updater Settings") + panel.show() + panelVbox = gtk.VBox(False, 0) + + malCredHbox = gtk.HBox(False,0) + malCredHbox.show() + self.malUpdaterOnCheck = gtk.CheckButton("MAL Updater On") + self.malUpdaterOnCheck.show() + malCredHbox.add(self.malUpdaterOnCheck) + self.clearCredentialsButton = gtk.Button("Clear Saved Credentials") + self.clearCredentialsButton.connect("clicked", lambda w: self._clearMalCredentials()) + self.clearCredentialsButton.show() + malCredHbox.add(self.clearCredentialsButton) + panelVbox.add(malCredHbox) + + self.malUsername = self._addLabeledEntryToVbox("Username: ", " ", panelVbox, lambda __, w: self._saveDataAndLeave()) + self.malPassword = self._addLabeledEntryToVbox("Password: ", " ", panelVbox, lambda __, w: self._saveDataAndLeave()) + + spinButtonHbox = gtk.HBox(True, 0) + percentBoxLabel = gtk.Label("Progress Threshold For Updating: ") + percentBoxLabel.show() + spinButtonHbox.add(percentBoxLabel) + self.percentBox = gtk.SpinButton(adjustment=gtk.Adjustment(0,1,100,1,1,0)) + self.percentBox.show() + spinButtonHbox.add(self.percentBox) + spinButtonHbox.show() + panelVbox.add(spinButtonHbox) + + panelVbox.show() + panel.add(panelVbox) + vbox.add(panel) + + def _clearMalCredentials(self): + return + def setAvailablePaths(self, paths): self._availablePlayerPaths = paths From f515e41dee995ee8354368a4568cf60caf8a1e55 Mon Sep 17 00:00:00 2001 From: TacticalGenius Date: Sun, 27 Jan 2013 16:14:41 -0600 Subject: [PATCH 5/5] [GUI] implemented Etohs suggestion regarding the label of the save button --- syncplay/ui/GuiConfiguration.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 39ca869..7290ebc 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -23,17 +23,19 @@ class GuiConfiguration: self._addCheckboxEntries(self.config, vbox) self._addMalPanel(vbox) self.hostEntry.select_region(0, len(self.hostEntry.get_text())) - button = gtk.Button(stock=gtk.STOCK_SAVE) - button.set_resize_mode(gtk.RESIZE_PARENT) - button.connect("clicked", lambda w: self._saveDataAndLeave()) + if self.config['noStore'] == True: + self.button = gtk.Button("Run Syncplay") + else: + self.button = gtk.Button("Save and Run Syncplay") + self.button.connect("clicked", lambda w: self._saveDataAndLeave()) guideLink = gtk.Button("Configuration Guide") guideLink.connect("clicked", lambda w: webbrowser.open("http://syncplay.pl/guide/")) guideLink.show() vbox.add(guideLink) - vbox.pack_start(button, True, True, 0) - button.set_flags(gtk.CAN_DEFAULT) - button.grab_default() - button.show() + vbox.pack_start(self.button, True, True, 0) + self.button.set_flags(gtk.CAN_DEFAULT) + self.button.grab_default() + self.button.show() self.window.show() gtk.main() @@ -129,6 +131,7 @@ class GuiConfiguration: self.alwaysShowCheck.set_active(True) self.alwaysShowCheck.show() self.storeConfigCheck = gtk.CheckButton("Do Not Store This Configuration") + self.storeConfigCheck.connect("toggled", lambda w: self._changeSaveLabel()) if self.config['noStore'] == True: self.storeConfigCheck.set_active(True) self.storeConfigCheck.show() @@ -141,6 +144,14 @@ class GuiConfiguration: CheckVbox.add(self.slowOnDesyncCheck) CheckVbox.show() + def _changeSaveLabel(self): + if self.config['noStore'] == True: + self.button.set_label("Save and Run Syncplay") + self.config['noStore'] = False + else: + self.button.set_label("Run Syncplay") + self.config['noStore'] = True + def _showPlayerFileDialog(self): dialog = gtk.FileChooserDialog(parent=self.window,action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) dialog.run()