Skip to content

Commit

Permalink
Updating the resource file to make the icon work again. TODO: upgrade…
Browse files Browse the repository at this point in the history
… the Makefile to qgis3
  • Loading branch information
wildintellect committed Nov 15, 2018
1 parent 1497db7 commit 1bbbebe
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ default: compile
compile: $(COMPILED_RESOURCE_FILES)

%_rc.py : %.qrc
pyrcc4 -o $*_rc.py $<
pyrcc5 -o $*_rc.py $<

%.qm : %.ts
lrelease $<
Expand Down
2 changes: 1 addition & 1 deletion literature_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction, QTableWidget, QTableWidgetItem, QMessageBox
# Initialize Qt resources from file resources.py
#from . import resources_rc
from . import resources_rc
# Import the code for the dialog
from .literature_mapper_dialog import LiteratureMapperDialog, TableInterface
import os.path
Expand Down
2 changes: 1 addition & 1 deletion resources.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/plugins/LiteratureMapper" >
<qresource prefix="/plugins/LiteratureMapper">
<file>icon.png</file>
</qresource>
</RCC>
32 changes: 25 additions & 7 deletions resources_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

# Resource object code
#
# Created: Tue Jun 9 12:00:56 2015
# by: The Resource Compiler for PyQt (Qt v4.8.5)
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.6)
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore

qt_resource_data = "\
qt_resource_data = b"\
\x00\x00\x05\x7c\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
Expand Down Expand Up @@ -102,7 +101,7 @@
\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
"

qt_resource_name = "\
qt_resource_name = b"\
\x00\x07\
\x07\x3b\xe0\xb3\
\x00\x70\
Expand All @@ -117,17 +116,36 @@
\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
"

qt_resource_struct = "\
qt_resource_struct_v1 = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
"

qt_resource_struct_v2 = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x50\x69\xac\x7f\xa0\
"

qt_version = QtCore.qVersion().split('.')
if qt_version < ['5', '8', '0']:
rcc_version = 1
qt_resource_struct = qt_resource_struct_v1
else:
rcc_version = 2
qt_resource_struct = qt_resource_struct_v2

def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)

def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)

qInitResources()

0 comments on commit 1bbbebe

Please sign in to comment.