Added default path setting
This commit is contained in:
parent
a073425823
commit
44d93f7583
Binary file not shown.
|
@ -34,9 +34,9 @@ class GWinWrap:
|
|||
self.window.connect("draw", self.area_draw)
|
||||
|
||||
# bind css file
|
||||
cssProvider = gtk.CssProvider()
|
||||
cssProvider = gtk.CssProvider()
|
||||
cssProvider.load_from_path('resources/stylesheet.css')
|
||||
screen = gdk.Screen.get_default()
|
||||
screen = gdk.Screen.get_default()
|
||||
styleContext = gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
|
||||
|
@ -77,12 +77,14 @@ class GWinWrap:
|
|||
xscreenList.append((file,))
|
||||
|
||||
self.selectedImg = None # EventBox holder
|
||||
self.defPath = None
|
||||
self.player = None
|
||||
self.imgVwr = None
|
||||
self.retrieveSettings()
|
||||
|
||||
self.retrieveSettings()
|
||||
self.window.show()
|
||||
|
||||
|
||||
def area_draw(self, widget, cr):
|
||||
cr.set_source_rgba(0, 0, 0, 0.64)
|
||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||
|
@ -234,16 +236,22 @@ class GWinWrap:
|
|||
self.builder.get_object("settingsWindow").popup()
|
||||
|
||||
def saveToSettingsFile(self, widget):
|
||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||
self.sttngsSver.saveSettings(self.player, self.imgVwr)
|
||||
self.defPath = self.builder.get_object("customDefaultPath").get_text().strip()
|
||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||
|
||||
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
|
||||
|
||||
def retrieveSettings(self):
|
||||
data = self.sttngsSver.retrieveSettings()
|
||||
self.player = data[0]
|
||||
self.imgVwr = data[1]
|
||||
data = self.sttngsSver.retrieveSettings()
|
||||
self.defPath = data[0]
|
||||
self.player = data[1]
|
||||
self.imgVwr = data[2]
|
||||
|
||||
self.builder.get_object("customDefaultPath").set_text(self.defPath)
|
||||
self.builder.get_object("customVideoPlyr").set_text(self.player)
|
||||
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
||||
self.builder.get_object("selectedDirDialog").set_filename(self.defPath)
|
||||
|
||||
def saveToFile(self, widget, data=None):
|
||||
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
||||
|
|
|
@ -685,6 +685,43 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixbuf">icons/folder.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="customDefaultPath">
|
||||
<property name="width_request">330</property>
|
||||
<property name="height_request">26</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">Set Custom Selected Path</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -720,7 +757,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -758,7 +795,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -774,7 +811,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -14,20 +14,20 @@ class SaveGWinWrapSettings:
|
|||
open(self.configFile, 'a').close()
|
||||
|
||||
|
||||
def saveSettings(self, player, imgVwr):
|
||||
def saveSettings(self, defPath, player, imgVwr):
|
||||
data = {}
|
||||
data['gwinwrap_settings'] = []
|
||||
|
||||
data['gwinwrap_settings'].append({
|
||||
'player': player,
|
||||
'imgvwr': imgVwr
|
||||
'defPath' : defPath,
|
||||
'player' : player,
|
||||
'imgvwr' : imgVwr
|
||||
})
|
||||
|
||||
with open(self.configFile, 'w') as outfile:
|
||||
json.dump(data, outfile)
|
||||
|
||||
|
||||
|
||||
def retrieveSettings(self):
|
||||
returnData = []
|
||||
|
||||
|
@ -35,14 +35,18 @@ class SaveGWinWrapSettings:
|
|||
try:
|
||||
data = json.load(infile)
|
||||
for obj in data['gwinwrap_settings']:
|
||||
returnData = [obj['player'], obj['imgvwr']]
|
||||
returnData = [obj['defPath'], obj['player'], obj['imgvwr']]
|
||||
except Exception as e:
|
||||
returnData = ['mplayer', 'xdg-open']
|
||||
returnData = ['', 'mplayer', 'xdg-open']
|
||||
|
||||
|
||||
if returnData[0] == '':
|
||||
returnData[0] = 'mplayer'
|
||||
returnData[0] = ''
|
||||
|
||||
if returnData[1] == '':
|
||||
returnData[1] = 'xdg-open'
|
||||
returnData[1] = 'mplayer'
|
||||
|
||||
if returnData[2] == '':
|
||||
returnData[2] = 'xdg-open'
|
||||
|
||||
return returnData
|
||||
|
|
|
@ -34,9 +34,9 @@ class GWinWrap:
|
|||
self.window.connect("draw", self.area_draw)
|
||||
|
||||
# bind css file
|
||||
cssProvider = gtk.CssProvider()
|
||||
cssProvider = gtk.CssProvider()
|
||||
cssProvider.load_from_path('resources/stylesheet.css')
|
||||
screen = gdk.Screen.get_default()
|
||||
screen = gdk.Screen.get_default()
|
||||
styleContext = gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
|
||||
|
@ -77,12 +77,14 @@ class GWinWrap:
|
|||
xscreenList.append((file,))
|
||||
|
||||
self.selectedImg = None # EventBox holder
|
||||
self.defPath = None
|
||||
self.player = None
|
||||
self.imgVwr = None
|
||||
self.retrieveSettings()
|
||||
|
||||
self.retrieveSettings()
|
||||
self.window.show()
|
||||
|
||||
|
||||
def area_draw(self, widget, cr):
|
||||
cr.set_source_rgba(0, 0, 0, 0.64)
|
||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||
|
@ -234,16 +236,22 @@ class GWinWrap:
|
|||
self.builder.get_object("settingsWindow").popup()
|
||||
|
||||
def saveToSettingsFile(self, widget):
|
||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||
self.sttngsSver.saveSettings(self.player, self.imgVwr)
|
||||
self.defPath = self.builder.get_object("customDefaultPath").get_text().strip()
|
||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||
|
||||
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
|
||||
|
||||
def retrieveSettings(self):
|
||||
data = self.sttngsSver.retrieveSettings()
|
||||
self.player = data[0]
|
||||
self.imgVwr = data[1]
|
||||
data = self.sttngsSver.retrieveSettings()
|
||||
self.defPath = data[0]
|
||||
self.player = data[1]
|
||||
self.imgVwr = data[2]
|
||||
|
||||
self.builder.get_object("customDefaultPath").set_text(self.defPath)
|
||||
self.builder.get_object("customVideoPlyr").set_text(self.player)
|
||||
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
||||
self.builder.get_object("selectedDirDialog").set_filename(self.defPath)
|
||||
|
||||
def saveToFile(self, widget, data=None):
|
||||
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
||||
|
|
|
@ -685,6 +685,43 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixbuf">icons/folder.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="customDefaultPath">
|
||||
<property name="width_request">330</property>
|
||||
<property name="height_request">26</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">Set Custom Selected Path</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -720,7 +757,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -758,7 +795,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -774,7 +811,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -14,20 +14,20 @@ class SaveGWinWrapSettings:
|
|||
open(self.configFile, 'a').close()
|
||||
|
||||
|
||||
def saveSettings(self, player, imgVwr):
|
||||
def saveSettings(self, defPath, player, imgVwr):
|
||||
data = {}
|
||||
data['gwinwrap_settings'] = []
|
||||
|
||||
data['gwinwrap_settings'].append({
|
||||
'player': player,
|
||||
'imgvwr': imgVwr
|
||||
'defPath' : defPath,
|
||||
'player' : player,
|
||||
'imgvwr' : imgVwr
|
||||
})
|
||||
|
||||
with open(self.configFile, 'w') as outfile:
|
||||
json.dump(data, outfile)
|
||||
|
||||
|
||||
|
||||
def retrieveSettings(self):
|
||||
returnData = []
|
||||
|
||||
|
@ -35,14 +35,18 @@ class SaveGWinWrapSettings:
|
|||
try:
|
||||
data = json.load(infile)
|
||||
for obj in data['gwinwrap_settings']:
|
||||
returnData = [obj['player'], obj['imgvwr']]
|
||||
returnData = [obj['defPath'], obj['player'], obj['imgvwr']]
|
||||
except Exception as e:
|
||||
returnData = ['mplayer', 'xdg-open']
|
||||
returnData = ['', 'mplayer', 'xdg-open']
|
||||
|
||||
|
||||
if returnData[0] == '':
|
||||
returnData[0] = 'mplayer'
|
||||
returnData[0] = ''
|
||||
|
||||
if returnData[1] == '':
|
||||
returnData[1] = 'xdg-open'
|
||||
returnData[1] = 'mplayer'
|
||||
|
||||
if returnData[2] == '':
|
||||
returnData[2] = 'xdg-open'
|
||||
|
||||
return returnData
|
||||
|
|
Loading…
Reference in New Issue