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
from PyQt5 import QtGui, QtCore
from os import path, getcwd
import json
import sys
from gui.irodsTreeView import IrodsModel
from gui.popupWidgets import irodsIndexPopup
......@@ -21,9 +22,14 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
+'\nDataCompression view not setup.')
return
ruleFiles = [path.join(getcwd(),'rules/tarCollection.r'),
path.join(getcwd(),'rules/tarReadIndex.r'),
path.join(getcwd(),'rules/tarExtract.r')]
if getattr(sys, 'frozen', False):
self.basefolder = path.join(path.dirname(path.realpath(sys.argv[0])), path.pardir)
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:
if not path.isfile(rule):
self.infoPopup('ERROR rules not configured:\n'+rule\
......@@ -100,7 +106,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
self.enableButtons(False)
self.createStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarCollection.r')
ruleFile = path.join(self.basefolder,'rules/tarCollection.r')
idx, source = self.collectionTreeModel.get_checked()
if not self.ic.session.collections.exists(source):
......@@ -179,7 +185,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
self.enableButtons(False)
self.unpackStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarExtract.r')
ruleFile = path.join(self.basefolder,'rules/tarExtract.r')
migrateResc = self.decompressRescButton.currentText()
params = {
......@@ -201,7 +207,7 @@ class irodsDataCompression(QWidget, Ui_tabDataCompression):
def getIndex(self):
self.unpackStatusLabel.clear()
ruleFile = path.join(getcwd(),'rules/tarReadIndex.r')
ruleFile = path.join(self.basefolder,'rules/tarReadIndex.r')
idx, source = self.compressionTreeModel.get_checked()
if source == None:
......
......@@ -54,7 +54,7 @@ def ui_to_py(ui_folder, python):
lines[(linenum + lineofset)] = spacing + text[0]
lines.insert(linenum + lineofset, f"{spacing}else:\n")
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
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