Added default path setting
This commit is contained in:
parent
a073425823
commit
44d93f7583
Binary file not shown.
|
@ -77,12 +77,14 @@ class GWinWrap:
|
||||||
xscreenList.append((file,))
|
xscreenList.append((file,))
|
||||||
|
|
||||||
self.selectedImg = None # EventBox holder
|
self.selectedImg = None # EventBox holder
|
||||||
|
self.defPath = None
|
||||||
self.player = None
|
self.player = None
|
||||||
self.imgVwr = None
|
self.imgVwr = None
|
||||||
self.retrieveSettings()
|
|
||||||
|
|
||||||
|
self.retrieveSettings()
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
def area_draw(self, widget, cr):
|
def area_draw(self, widget, cr):
|
||||||
cr.set_source_rgba(0, 0, 0, 0.64)
|
cr.set_source_rgba(0, 0, 0, 0.64)
|
||||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||||
|
@ -234,16 +236,22 @@ class GWinWrap:
|
||||||
self.builder.get_object("settingsWindow").popup()
|
self.builder.get_object("settingsWindow").popup()
|
||||||
|
|
||||||
def saveToSettingsFile(self, widget):
|
def saveToSettingsFile(self, widget):
|
||||||
|
self.defPath = self.builder.get_object("customDefaultPath").get_text().strip()
|
||||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||||
self.sttngsSver.saveSettings(self.player, self.imgVwr)
|
|
||||||
|
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
|
||||||
|
|
||||||
def retrieveSettings(self):
|
def retrieveSettings(self):
|
||||||
data = self.sttngsSver.retrieveSettings()
|
data = self.sttngsSver.retrieveSettings()
|
||||||
self.player = data[0]
|
self.defPath = data[0]
|
||||||
self.imgVwr = data[1]
|
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("customVideoPlyr").set_text(self.player)
|
||||||
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
||||||
|
self.builder.get_object("selectedDirDialog").set_filename(self.defPath)
|
||||||
|
|
||||||
def saveToFile(self, widget, data=None):
|
def saveToFile(self, widget, data=None):
|
||||||
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
||||||
|
|
|
@ -685,6 +685,43 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</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>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -720,7 +757,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -758,7 +795,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -774,7 +811,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -14,11 +14,12 @@ class SaveGWinWrapSettings:
|
||||||
open(self.configFile, 'a').close()
|
open(self.configFile, 'a').close()
|
||||||
|
|
||||||
|
|
||||||
def saveSettings(self, player, imgVwr):
|
def saveSettings(self, defPath, player, imgVwr):
|
||||||
data = {}
|
data = {}
|
||||||
data['gwinwrap_settings'] = []
|
data['gwinwrap_settings'] = []
|
||||||
|
|
||||||
data['gwinwrap_settings'].append({
|
data['gwinwrap_settings'].append({
|
||||||
|
'defPath' : defPath,
|
||||||
'player' : player,
|
'player' : player,
|
||||||
'imgvwr' : imgVwr
|
'imgvwr' : imgVwr
|
||||||
})
|
})
|
||||||
|
@ -27,7 +28,6 @@ class SaveGWinWrapSettings:
|
||||||
json.dump(data, outfile)
|
json.dump(data, outfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def retrieveSettings(self):
|
def retrieveSettings(self):
|
||||||
returnData = []
|
returnData = []
|
||||||
|
|
||||||
|
@ -35,14 +35,18 @@ class SaveGWinWrapSettings:
|
||||||
try:
|
try:
|
||||||
data = json.load(infile)
|
data = json.load(infile)
|
||||||
for obj in data['gwinwrap_settings']:
|
for obj in data['gwinwrap_settings']:
|
||||||
returnData = [obj['player'], obj['imgvwr']]
|
returnData = [obj['defPath'], obj['player'], obj['imgvwr']]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
returnData = ['mplayer', 'xdg-open']
|
returnData = ['', 'mplayer', 'xdg-open']
|
||||||
|
|
||||||
|
|
||||||
if returnData[0] == '':
|
if returnData[0] == '':
|
||||||
returnData[0] = 'mplayer'
|
returnData[0] = ''
|
||||||
|
|
||||||
if returnData[1] == '':
|
if returnData[1] == '':
|
||||||
returnData[1] = 'xdg-open'
|
returnData[1] = 'mplayer'
|
||||||
|
|
||||||
|
if returnData[2] == '':
|
||||||
|
returnData[2] = 'xdg-open'
|
||||||
|
|
||||||
return returnData
|
return returnData
|
||||||
|
|
|
@ -77,12 +77,14 @@ class GWinWrap:
|
||||||
xscreenList.append((file,))
|
xscreenList.append((file,))
|
||||||
|
|
||||||
self.selectedImg = None # EventBox holder
|
self.selectedImg = None # EventBox holder
|
||||||
|
self.defPath = None
|
||||||
self.player = None
|
self.player = None
|
||||||
self.imgVwr = None
|
self.imgVwr = None
|
||||||
self.retrieveSettings()
|
|
||||||
|
|
||||||
|
self.retrieveSettings()
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
def area_draw(self, widget, cr):
|
def area_draw(self, widget, cr):
|
||||||
cr.set_source_rgba(0, 0, 0, 0.64)
|
cr.set_source_rgba(0, 0, 0, 0.64)
|
||||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||||
|
@ -234,16 +236,22 @@ class GWinWrap:
|
||||||
self.builder.get_object("settingsWindow").popup()
|
self.builder.get_object("settingsWindow").popup()
|
||||||
|
|
||||||
def saveToSettingsFile(self, widget):
|
def saveToSettingsFile(self, widget):
|
||||||
|
self.defPath = self.builder.get_object("customDefaultPath").get_text().strip()
|
||||||
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
|
||||||
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
|
||||||
self.sttngsSver.saveSettings(self.player, self.imgVwr)
|
|
||||||
|
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
|
||||||
|
|
||||||
def retrieveSettings(self):
|
def retrieveSettings(self):
|
||||||
data = self.sttngsSver.retrieveSettings()
|
data = self.sttngsSver.retrieveSettings()
|
||||||
self.player = data[0]
|
self.defPath = data[0]
|
||||||
self.imgVwr = data[1]
|
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("customVideoPlyr").set_text(self.player)
|
||||||
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
self.builder.get_object("customImgVwr").set_text(self.imgVwr)
|
||||||
|
self.builder.get_object("selectedDirDialog").set_filename(self.defPath)
|
||||||
|
|
||||||
def saveToFile(self, widget, data=None):
|
def saveToFile(self, widget, data=None):
|
||||||
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
saveLoc = self.builder.get_object("saveLoc").get_active_text()
|
||||||
|
|
|
@ -685,6 +685,43 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</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>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -720,7 +757,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -758,7 +795,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -774,7 +811,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -14,11 +14,12 @@ class SaveGWinWrapSettings:
|
||||||
open(self.configFile, 'a').close()
|
open(self.configFile, 'a').close()
|
||||||
|
|
||||||
|
|
||||||
def saveSettings(self, player, imgVwr):
|
def saveSettings(self, defPath, player, imgVwr):
|
||||||
data = {}
|
data = {}
|
||||||
data['gwinwrap_settings'] = []
|
data['gwinwrap_settings'] = []
|
||||||
|
|
||||||
data['gwinwrap_settings'].append({
|
data['gwinwrap_settings'].append({
|
||||||
|
'defPath' : defPath,
|
||||||
'player' : player,
|
'player' : player,
|
||||||
'imgvwr' : imgVwr
|
'imgvwr' : imgVwr
|
||||||
})
|
})
|
||||||
|
@ -27,7 +28,6 @@ class SaveGWinWrapSettings:
|
||||||
json.dump(data, outfile)
|
json.dump(data, outfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def retrieveSettings(self):
|
def retrieveSettings(self):
|
||||||
returnData = []
|
returnData = []
|
||||||
|
|
||||||
|
@ -35,14 +35,18 @@ class SaveGWinWrapSettings:
|
||||||
try:
|
try:
|
||||||
data = json.load(infile)
|
data = json.load(infile)
|
||||||
for obj in data['gwinwrap_settings']:
|
for obj in data['gwinwrap_settings']:
|
||||||
returnData = [obj['player'], obj['imgvwr']]
|
returnData = [obj['defPath'], obj['player'], obj['imgvwr']]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
returnData = ['mplayer', 'xdg-open']
|
returnData = ['', 'mplayer', 'xdg-open']
|
||||||
|
|
||||||
|
|
||||||
if returnData[0] == '':
|
if returnData[0] == '':
|
||||||
returnData[0] = 'mplayer'
|
returnData[0] = ''
|
||||||
|
|
||||||
if returnData[1] == '':
|
if returnData[1] == '':
|
||||||
returnData[1] = 'xdg-open'
|
returnData[1] = 'mplayer'
|
||||||
|
|
||||||
|
if returnData[2] == '':
|
||||||
|
returnData[2] = 'xdg-open'
|
||||||
|
|
||||||
return returnData
|
return returnData
|
||||||
|
|
Loading…
Reference in New Issue