Beispiel #1
0
    def update(self):
        items = int(len(self.last[self.pos]) / 2)
        for i in range(0, 5):
            self.box[i].hide()

        for i in range(0, items):
            all_text = self.last[self.pos][i * 2 + 1]
            nbr = all_text.count("<br>")
            end_text = len(all_text.split("<br>")[-1])
            pixmap = QPixmap(get_icon_path(self.last[self.pos][i * 2],
                                           size=32))
            self.image[i].setPixmap(pixmap)
            text = all_text + "<br>"
            self.label[i].setText(text)
            height = ((end_text / 80) + nbr) * 20

            #self.label[i].setFixedSize(380,300)
            self.label[i].adjustSize()
            self.label[i].setOpenExternalLinks(True)
            self.box[i].show()
            #self.image[i].show()

        self.resize(300, items * self.item_height)

        self.forward.setEnabled(True)
        self.back.setEnabled(True)

        if self.pos == 0:
            self.back.setEnabled(False)

        if self.pos == len(self.last) - 1:
            self.forward.setEnabled(False)

        self.status_bar.showMessage(
            str(self.pos) + "/" + str(len(self.last) - 1))
Beispiel #2
0
def QIcon_load(name, size=-1):
    global use_theme
    if use_theme == None:
        use_theme = inp_get_token_value(
            os.path.join(os.getcwd(), "config.inp"), "#gui_use_icon_theme")
        if use_theme == None:
            use_theme = False
        else:
            use_theme = str2bool(use_theme)

    if running_on_linux() == True and use_theme == True:
        image = QIcon()
        if image.hasThemeIcon(name) == True:
            return image.fromTheme(name)

    return QIcon(get_icon_path(name, size=size))
Beispiel #3
0
	def init(self):
		QWidget.__init__(self)
		self.item_height=10
		self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
		#self.setFixedSize(400,160)
		#self.setFixedWidth(700)

		self.setStyleSheet(" padding:0px; margin-top:0px; margin-bottom:0px")
		#; border:2px solid rgb(0, 0, 0); 

		self.last=[]
		self.pos=-1

		self.move_window()
		self.vbox = QVBoxLayout()

		#self.vbox.setAlignment(Qt.AlignTop)
		self.box=[]
		self.image=[]
		self.label=[]
		for i in range(0,5):
			l=QHBoxLayout()
			label=QLabel()
			label.setWordWrap(True)
			label.setOpenExternalLinks(True)
			image=QLabel()
			font = QFont()
			font.setPointSize(18)
			label.setFont(font)

			image.setFixedWidth(64)
			image.setAlignment(Qt.AlignLeft | Qt.AlignTop)
			self.box.append( QWidget())
			self.image.append(image)
			label.setAlignment(Qt.AlignLeft | Qt.AlignTop)
			self.label.append(label)

			self.box[i].setLayout(l)
			#self.box[i].setFixedSize(380,80)	#setMinimumSize(400, 500)#
			l.addWidget(self.image[i])
			l.addWidget(self.label[i])

		toolbar=QToolBar()
		toolbar.setIconSize(QSize(48, 48))

		self.back = QAction(icon_get("go-previous",size=32), _("Back"), self)
		self.back.triggered.connect(self.callback_back)
		toolbar.addAction(self.back)

		self.forward= QAction(icon_get("go-next",size=32), _("Next"), self)
		self.forward.triggered.connect(self.callback_forward)
		toolbar.addAction(self.forward)


		spacer = QWidget()
		spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
		toolbar.addWidget(spacer)


		self.undo = QAction(QIcon(get_icon_path("www")), _("Online help"), self)
		self.undo.setStatusTip(_("On line help"))
		self.undo.triggered.connect(self.on_line_help)
		toolbar.addAction(self.undo)

		self.undo = QAction(icon_get("close",size=32), _("Hide"), self)
		self.undo.setStatusTip(_("Close"))
		self.undo.triggered.connect(self.callback_close)
		toolbar.addAction(self.undo)




		self.vbox.addWidget(toolbar)

		for i in range(0,5):
			self.vbox.addWidget(self.box[i])

		self.vbox.addStretch()

		self.status_bar = QStatusBar()
		self.vbox.addWidget(self.status_bar)
		
		self.setLayout(self.vbox)