ToolbarTools/toolbartools/Spacer.py
Juraj Oravec 0b7bf53a1c
Add spacers
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
2019-06-24 23:33:59 +02:00

53 lines
1.5 KiB
Python

# Toolbar Tools - Falkon plugin
# Copyright (C) 2019 Juraj Oravec <sgd.orava@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from PySide2 import QtWidgets
class Spacer(QtWidgets.QWidget):
number = None
def __init__(self, number=None, maxWidth=400):
super().__init__()
sizePolicy = self.sizePolicy()
sizePolicy.setHorizontalPolicy(QtWidgets.QSizePolicy.Expanding)
self.setSizePolicy(sizePolicy)
if number:
self.number = number
else:
self.number = 1
if maxWidth:
self.setMaximumWidth(maxWidth)
else:
self.setMaximumWidth(100)
def id(self):
if self.number:
return "spacer_" + str(self.number)
return "spacer_1"
def name(self):
if self.number:
return "Spacer " + str(self.number)
return "Spacer 1"