#!/usr/bin/env python3 import sys import os from PyQt5 import uic from PyQt5.QtGui import QIcon,QPixmap,QCursor from PyQt5.QtCore import Qt,QEvent,QPoint,QSize from PyQt5.QtWidgets import QLabel, QWidget,QVBoxLayout,QHBoxLayout,QCheckBox,QSizePolicy,QToolButton,QMenu,QToolTip from . import waitingSpinner from . import settings import gettext gettext.textdomain(settings.TEXT_DOMAIN) _ = gettext.gettext class InstallersBox(QWidget): def __init__(self): super(InstallersBox, self).__init__() # Call the inherited classes __init__ method self.core=Core.Core.get_core() ui_file=self.core.rsrc_dir+"installersBox.ui" uic.loadUi(ui_file, self) # Load the .ui fil self.boxInstallers=self.findChild(QVBoxLayout,'installersBox') self.boxInstallers.setAlignment(Qt.AlignTop) self.scrollArea=self.findChild(QWidget,'scrollAreaWidgetContents') self.scrollArea.setStyleSheet("background-color:white") self.box_selected=[] self.flavours_selected=[] #def __init__ def drawInstallerList(self): self.total_flavours=0 self.total_flavours=self.core.flavourSelectorManager.total_flavours ''' for item in self.core.flavourSelectorManager.flavour_list: if self.core.flavourSelectorManager.flavour_list[item]["show"]: self.total_flavours+=1 ''' self.count=0 for item in self.core.flavourSelectorManager.flavour_list: alternative_type="" alternative_list="" if self.core.flavourSelectorManager.flavour_list[item]["show"]: self.count+=1 if "client" in self.core.flavourSelectorManager.flavour_list[item]["pkg"]: if len(self.core.flavourSelectorManager.client_desktop_alternatives)>0: alternative_type="client-desktop" alternative_list=self.core.flavourSelectorManager.client_desktop_alternatives elif len(self.core.flavourSelectorManager.client_lite_alternatives)>0: alternative_type="client-lite" alternative_list=self.core.flavourSelectorManager.client_lite_alternatives if "server" in self.core.flavourSelectorManager.flavour_list[item]["pkg"]: if len(self.core.flavourSelectorManager.server_alternatives)>0: alternative_type="server" alternative_list=self.core.flavourSelectorManager.server_alternatives if "desktop" in self.core.flavourSelectorManager.flavour_list[item]["pkg"]: if len(self.core.flavourSelectorManager.desktop_alternatives)>0: alternative_type="desktop" alternative_list=self.core.flavourSelectorManager.desktop_alternatives self.newInstallerBox(self.core.flavourSelectorManager.flavour_list[item],item,alternative_type,alternative_list) #def drawInstallerList def newInstallerBox(self,item,order,alternative_type,alternative_list): hbox=QHBoxLayout() hbox.setContentsMargins(0,0,0,0) hbox.setSpacing(0) checkbox=QCheckBox() checkbox.setTristate(False) checkbox.stateChanged.connect(self.changeState) title=self.getTitle(item["pkg"]) checkbox.setStyleSheet("padding:10px;height:80px") checkbox.item=item checkbox.pkg=item["pkg"] checkbox.alternative_type=alternative_type checkbox.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)); hbox.addWidget(checkbox) icon=QLabel() pixmap=QPixmap(item["banner"]) icon.setPixmap(pixmap) icon.setAlignment(Qt.AlignCenter|Qt.AlignVCenter) icon.setMinimumSize(75,75) icon.setMaximumSize(75,75) icon.item=item hbox.addWidget(icon) name=QLabel() name.setText(item["name"]+": "+title) name.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) if self.count