Skip to content

Commit

Permalink
Merge pull request #48 from hsorby/rename-plugin-fixes
Browse files Browse the repository at this point in the history
Fix rename plugin
  • Loading branch information
hsorby authored Mar 30, 2022
2 parents 85d2c4c + 5f23d1d commit e3a37fc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/mapclient/core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
import os.path
import platform

from PySide2 import QtCore

from mapclient.settings.definitions import GIT_EXE, \
PYSIDE_RCC_EXE, PYSIDE_UIC_EXE, USE_EXTERNAL_GIT, INTERNAL_EXE, \
PYSIDE_RCC_EXE, PYSIDE_UIC_EXE, USE_EXTERNAL_GIT, \
USE_EXTERNAL_RCC, USE_EXTERNAL_UIC
from mapclient.core.utils import which, qt_tool_wrapper

Expand Down
4 changes: 2 additions & 2 deletions src/mapclient/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ def is_binary(filename):
CHUNK_SIZE = 1024
while 1:
chunk = fin.read(CHUNK_SIZE)
if b'\0' in chunk: # found null byte
if b'\0' in chunk: # found null byte
return True
if len(chunk) < CHUNK_SIZE:
break # done
break # done

return False

Expand Down
17 changes: 8 additions & 9 deletions src/mapclient/tools/renameplugin/renamedialog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import os

import shutil
Expand All @@ -8,7 +7,7 @@

from mapclient.core.managers.pluginmanager import isMapClientPluginsDir
from mapclient.core.utils import grep, determinePackageName, determineStepClassName, determineStepName, \
convertNameToPythonPackage, find_file
convertNameToPythonPackage, find_file, qt_tool_wrapper
from mapclient.settings.definitions import PLUGINS_PACKAGE_NAME
from mapclient.tools.renameplugin.ui.ui_renamedialog import Ui_RenameDialog

Expand Down Expand Up @@ -138,8 +137,8 @@ def _interrogateTarget(self):
self._ui.lineEditRenameStepFrom.setText(step_name)
self._ui.lineEditRenamePackageFrom.setText(package_name)
else:
QtGui.QMessageBox.warning(self, 'Rename',
'Target directory is not recognized as a MAP Client plugin directory')
QtWidgets.QMessageBox.warning(self, 'Rename',
'Target directory is not recognized as a MAP Client plugin directory')

def _renameClicked(self):
tree = self._ui.treeWidgetRename
Expand Down Expand Up @@ -169,11 +168,11 @@ def _updateResourceFile(self):
qrc_file = find_file('resources.qrc', target)
python_rc_file = find_file('resources_rc.py', target)
if qrc_file is None or python_rc_file is None:
return -1
p = subprocess.Popen([self._pyside_rcc, '-py3', qrc_file, '-o', python_rc_file],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
return p.returncode
return 1

return_code, _ = qt_tool_wrapper(self._pyside_rcc, ['-g', 'python', '-o', python_rc_file, qrc_file], self._pyside_rcc != "rcc")

return return_code

def _doDirectoryRename(self):
target = self._ui.lineEditStepLocation.text()
Expand Down
5 changes: 4 additions & 1 deletion src/mapclient/view/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ def _show_rename_plugin_dialog(self):
from mapclient.tools.renameplugin.renamedialog import RenameDialog

om = self._model.optionsManager()
dlg = RenameDialog(om.getOption(PYSIDE_RCC_EXE), self)
rcc_exe = "rcc"
if om.getOption(USE_EXTERNAL_RCC):
rcc_exe = om.getOption(PYSIDE_RCC_EXE)
dlg = RenameDialog(rcc_exe, self)
dlg.setModal(True)
dlg.exec_()

Expand Down

0 comments on commit e3a37fc

Please sign in to comment.