Skip to content

Commit

Permalink
AddonManager: cosmetic fixes + prevision formacro icons
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jun 17, 2019
1 parent d99a1e3 commit 33ce0f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/Mod/AddonManager/AddonManager.py
Expand Up @@ -264,7 +264,7 @@ def add_addon_repo(self, addon_repo):
addonicon = QtGui.QIcon(":/icons/Group.svg")
if addon_repo[2] == 1:
item = QtGui.QListWidgetItem(addonicon,str(addon_repo[0]) + str(" ("+translate("AddonsInstaller","Installed")+")"))
item.setBackground(QtGui.QBrush(QtGui.QColor(0,182,41)))
item.setForeground(QtGui.QBrush(QtGui.QColor(0,182,41)))
self.dialog.listWorkbenches.addItem(item)
else:
self.dialog.listWorkbenches.addItem(QtGui.QListWidgetItem(addonicon,str(addon_repo[0])))
Expand Down Expand Up @@ -363,12 +363,15 @@ def add_macro(self, macro):
else:
from PySide import QtGui
self.macros.append(macro)
addonicon = QtGui.QIcon(":/icons/" + macro.name.replace(" ","_") + "_macro_icon.svg")
if addonicon.isNull():
addonicon = QtGui.QIcon(":/icons/applications-python.svg")
if macro.is_installed():
item = QtGui.QListWidgetItem(QtGui.QIcon(":/icons/applications-python.svg"), macro.name + str(' (Installed)'))
item.setBackground(QtGui.QBrush(QtGui.QColor(0,182,41)))
item = QtGui.QListWidgetItem(addonicon, macro.name + str(' (Installed)'))
item.setForeground(QtGui.QBrush(QtGui.QColor(0,182,41)))
self.dialog.listMacros.addItem(item)
else:
self.dialog.listMacros.addItem(QtGui.QListWidgetItem(QtGui.QIcon(":/icons/applications-python.svg"),macro.name))
self.dialog.listMacros.addItem(QtGui.QListWidgetItem(addonicon,macro.name))

def install(self,repos=None):

Expand Down Expand Up @@ -554,7 +557,7 @@ def mark(self,repo):
w = self.dialog.listWorkbenches.item(i)
if w.text().startswith(str(repo)):
w.setText(str(repo) + str(" ("+translate("AddonsInstaller","Update available")+")"))
w.setBackground(QtGui.QBrush(QtGui.QColor(182,90,0)))
w.setForeground(QtGui.QBrush(QtGui.QColor(182,90,0)))
if not repo in self.doUpdate:
self.doUpdate.append(repo)

Expand Down
6 changes: 3 additions & 3 deletions src/Mod/AddonManager/addonmanager_workers.py
Expand Up @@ -383,7 +383,7 @@ def run(self):

self.info_label.emit( message )
self.progressbar_show.emit(False)
l = self.loadImages( message, url )
l = self.loadImages( message, self.repos[self.idx][1] )
if l:
self.info_label.emit( l )
self.stop = True
Expand All @@ -403,6 +403,7 @@ def loadImages(self,message,url):
if not os.path.exists(store):
os.makedirs(store)
for path in imagepaths:
origpath = path
if "?" in path:
# remove everything after the ?
path = path.split("?")[0]
Expand Down Expand Up @@ -431,8 +432,7 @@ def loadImages(self,message,url):
pix = QtGui.QPixmap()
pix = pix.fromImage(img.scaled(300,300,QtCore.Qt.KeepAspectRatio,QtCore.Qt.FastTransformation))
pix.save(storename, "jpeg",100)

message = message.replace(path,"file:///"+storename.replace("\\","/"))
message = message.replace(origpath,"file:///"+storename.replace("\\","/"))
return message
return None

Expand Down

0 comments on commit 33ce0f3

Please sign in to comment.