Commit a2c5b92f authored by Daalen, Tim van's avatar Daalen, Tim van
Browse files

making rules and icons findable in executable

parent 72a85f00
...@@ -3,6 +3,7 @@ from PyQt5.QtCore import QObject, QThread, pyqtSlot, pyqtSignal ...@@ -3,6 +3,7 @@ from PyQt5.QtCore import QObject, QThread, pyqtSlot, pyqtSignal
from PyQt5 import QtGui, QtCore from PyQt5 import QtGui, QtCore
from os import path, getcwd from os import path, getcwd
import json import json
import sys
from gui.irodsTreeView import IrodsModel from gui.irodsTreeView import IrodsModel
from gui.popupWidgets import irodsIndexPopup from gui.popupWidgets import irodsIndexPopup
...@@ -21,9 +22,14 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression): ...@@ -21,9 +22,14 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
+'\nDataCompression view not setup.') +'\nDataCompression view not setup.')
return return
ruleFiles = [path.join(getcwd(),'rules/tarCollection.r'), if getattr(sys, 'frozen', False):
path.join(getcwd(),'rules/tarReadIndex.r'), self.basefolder = path.join(path.dirname(path.realpath(sys.argv[0])), path.pardir)
path.join(getcwd(),'rules/tarExtract.r')] else:
self.basefolder = path.dirname(path.realpath(sys.argv[0]))
ruleFiles = [path.join(self.basefolder,'rules/tarCollection.r'),
path.join(self.basefolder,'rules/tarReadIndex.r'),
path.join(self.basefolder,'rules/tarExtract.r')]
for rule in ruleFiles: for rule in ruleFiles:
if not path.isfile(rule): if not path.isfile(rule):
self.infoPopup('ERROR rules not configured:\n'+rule\ self.infoPopup('ERROR rules not configured:\n'+rule\
...@@ -100,7 +106,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression): ...@@ -100,7 +106,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
self.enableButtons(False) self.enableButtons(False)
self.createStatusLabel.clear() self.createStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarCollection.r') ruleFile = path.join(self.basefolder,'rules/tarCollection.r')
idx, source = self.collectionTreeModel.get_checked() idx, source = self.collectionTreeModel.get_checked()
if not self.ic.session.collections.exists(source): if not self.ic.session.collections.exists(source):
...@@ -179,7 +185,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression): ...@@ -179,7 +185,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
self.enableButtons(False) self.enableButtons(False)
self.unpackStatusLabel.clear() self.unpackStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarExtract.r') ruleFile = path.join(self.basefolder,'rules/tarExtract.r')
migrateResc = self.decompressRescButton.currentText() migrateResc = self.decompressRescButton.currentText()
params = { params = {
...@@ -201,7 +207,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression): ...@@ -201,7 +207,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
def getIndex(self): def getIndex(self):
self.unpackStatusLabel.clear() self.unpackStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarReadIndex.r') ruleFile = path.join(self.basefolder,'rules/tarReadIndex.r')
idx, source = self.compressionTreeModel.get_checked() idx, source = self.compressionTreeModel.get_checked()
if source == None: if source == None:
......
...@@ -54,7 +54,7 @@ def ui_to_py(ui_folder, python): ...@@ -54,7 +54,7 @@ def ui_to_py(ui_folder, python):
lines[(linenum + lineofset)] = spacing + text[0] lines[(linenum + lineofset)] = spacing + text[0]
lines.insert(linenum + lineofset, f"{spacing}else:\n") lines.insert(linenum + lineofset, f"{spacing}else:\n")
lines.insert(linenum + lineofset, spacing + text[1]) lines.insert(linenum + lineofset, spacing + text[1])
lines.insert(linenum + lineofset, f"{spacing}if getattr(sys, 'frozen', True):\n") lines.insert(linenum + lineofset, f"{spacing}if getattr(sys, 'frozen', False):\n")
lineofset = lineofset + 3 lineofset = lineofset + 3
lines.insert(10, "import sys\n") lines.insert(10, "import sys\n")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment