Added default path setting

This commit is contained in:
Maxim Stewart 2019-06-02 16:38:50 -05:00
parent a073425823
commit 44d93f7583
7 changed files with 138 additions and 40 deletions

Binary file not shown.

View File

@ -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.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.player, self.imgVwr)
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
def retrieveSettings(self):
data = self.sttngsSver.retrieveSettings()
self.player = data[0]
self.imgVwr = data[1]
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()

View File

@ -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>

View File

@ -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

16
python/src/versions/0.0.1/GWinWrap/GWinWrap.py Normal file → Executable file
View File

@ -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.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.player, self.imgVwr)
self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr)
def retrieveSettings(self):
data = self.sttngsSver.retrieveSettings()
self.player = data[0]
self.imgVwr = data[1]
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()

View File

@ -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>

View File

@ -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