Skip to content

Commit

Permalink
Task #16513. Dopasowanie interfejsu pod skalowanie. Zmiana nazw widgetów
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiamiekina committed Jul 22, 2022
1 parent d7ae277 commit 777a1e6
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 75 deletions.
41 changes: 27 additions & 14 deletions Kompozycje/Kompozycje.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def run(self):
self.dlg.dodaj_kompozycje.clicked.connect(self.dodaj)
self.dlg.edytuj_kompozycje.clicked.connect(self.edytuj)
self.dlg.usun_kompozycje.clicked.connect(self.usun)
self.dlg.zapisz.clicked.connect(self.write_file)
self.dlg.wczytaj.clicked.connect(self.read_file)
self.dlg.save.clicked.connect(self.write_file)
self.dlg.load.clicked.connect(self.read_file)
self.dlg.komp_dol.clicked.connect(self.move_comp_down)
self.dlg.komp_gora.clicked.connect(self.move_comp_up)
self.model_kompozycji.rowsInserted.connect(self.comps_order_change)
Expand All @@ -224,9 +224,12 @@ def run(self):
self.save()

def set_font_dodajkompozycje(self, font_size):
attributes = [self.dlg.pushButton_2, self.dlg.wczytaj, self.dlg.zapisz, self.dlg.frame_23, self.dlg.frame_24]
attributes = [self.dlg.pushButton_side, self.dlg.load, self.dlg.save,
self.dlg.frame_main, self.dlg.frame_title]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} QPushButton, QLabel, QTableView {{font: {font_size}pt;}}; font: {font_size}pt;')
attr.setStyleSheet(
f'{attr.styleSheet()} QPushButton, QLabel, QTableView '
f'{{font: {font_size}pt;}}; font: {font_size}pt;')


def write_file(self):
Expand Down Expand Up @@ -510,10 +513,10 @@ def run(self):
self.write()

def set_font_compositionsaver(self, font_size):
self.dlg.groupBox_11.setStyleSheet(
f'{self.dlg.groupBox_11.styleSheet()} QPushButton {{font: {font_size}pt;}}')
attributes = [self.dlg.label_2, self.dlg.pushButton_3,
self.dlg.title_label_12, self.dlg.frame_2]
self.dlg.groupBox_main.setStyleSheet(
f'{self.dlg.groupBox_main.styleSheet()} QPushButton {{font: {font_size}pt;}}')
attributes = [self.dlg.label_side, self.dlg.pushButton_cancel,
self.dlg.title_label, self.dlg.frame_compositions]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} font: {font_size}pt;')

Expand All @@ -537,7 +540,7 @@ def run_comp_adder(self, order_no):
self.kompozycje.dock, tr('No layers in project!')).button_ok()
return
self.dlg = NowaKompozycjaDialog()
self.dlg.pushButton_2.clicked.connect(self.save)
self.dlg.pushButton_save.clicked.connect(self.save)
self.dlg.dodaj_warstwe.clicked.connect(self.add_layer)
self.dlg.usun_warstwe.clicked.connect(self.del_layer)
self.dlg.wdol_warstwe.clicked.connect(self.move_down)
Expand All @@ -552,10 +555,10 @@ def run_comp_adder(self, order_no):
self.dlg.exec_()

def set_font_nowakompozycja(self, font_size):
self.dlg.frame.setStyleSheet(
f'{self.dlg.frame.styleSheet()} QFrame, QLabel, QWidget {{font: {font_size}pt;}}')
attributes = [self.dlg.frame_2, self.dlg.frame_3, self.dlg.frame_4, self.dlg.pushButton,
self.dlg.pushButton_2, self.dlg.label_3]
self.dlg.frame_main.setStyleSheet(
f'{self.dlg.frame_main.styleSheet()} QFrame, QLabel, QWidget {{font: {font_size}pt;}}')
attributes = [self.dlg.frame_groups, self.dlg.frame_title, self.dlg.frame_layers,
self.dlg.pushButton_cancel, self.dlg.pushButton_save, self.dlg.label_side]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} font: {font_size}pt;')

Expand Down Expand Up @@ -743,19 +746,29 @@ def run_comp_editor(self):
self.root = QgsProject.instance().layerTreeRoot()
self.dlg = NowaKompozycjaDialog()
self.dlg.title_label_3.setText(tr('Edit'))
self.dlg.pushButton_2.clicked.connect(self.save)
self.dlg.pushButton_save.clicked.connect(self.save)
self.dlg.dodaj_warstwe.clicked.connect(self.add_layer)
self.dlg.usun_warstwe.clicked.connect(self.del_layer)
self.dlg.wdol_warstwe.clicked.connect(self.move_down)
self.dlg.wgore_warstwe.clicked.connect(self.move_up)
self.dlg.wdol_warstwe.hide()
self.dlg.wgore_warstwe.hide()
self.wczytaj_grupy()
if config().setts['font_changed']:
self.set_font_nowakompozycja(font_size())
if self.ustaw_okno():
if not self.dlg.isActiveWindow():
self.dlg.show()
self.dlg.exec_()

def set_font_nowakompozycja(self, font_size):
self.dlg.frame_main.setStyleSheet(
f'{self.dlg.frame_main.styleSheet()} QFrame, QLabel, QWidget {{font: {font_size}pt;}}')
attributes = [self.dlg.frame_groups, self.dlg.frame_title, self.dlg.frame_layers,
self.dlg.pushButton_cancel, self.dlg.pushButton_save, self.dlg.label_side]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} font: {font_size}pt;')

def ustaw_okno(self):
table = self.pokaz_kompozycje.dlg.tableView
model = table.selectionModel()
Expand Down
14 changes: 7 additions & 7 deletions Kompozycje/compositions_saver.ui
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ border: 1px solid #5689b0;
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<widget class="QLabel" name="title_label_12">
<widget class="QLabel" name="title_label">
<property name="geometry">
<rect>
<x>10</x>
Expand Down Expand Up @@ -266,7 +266,7 @@ border: 1px solid #5689b0;
</property>
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_11">
<widget class="QGroupBox" name="groupBox_main">
<property name="styleSheet">
<string notr="true">QGroupBox{
border: None;
Expand All @@ -280,7 +280,7 @@ QPushButton:pressed{
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QFrame" name="frame_2">
<widget class="QFrame" name="frame_compositions">
<property name="styleSheet">
<string notr="true">border: 1px solid #0A0C0D;
border-radius: 10px;
Expand Down Expand Up @@ -459,7 +459,7 @@ color: #0A0C0D;
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<widget class="QPushButton" name="pushButton_cancel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -530,7 +530,7 @@ border-right: 2px solid #b7d3e8;
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_side">
<property name="styleSheet">
<string notr="true"> background-color: #b7d3e8;
color: #0A0C0D;
Expand Down Expand Up @@ -561,15 +561,15 @@ border-right: 2px solid #b7d3e8;
</item>
</layout>
<zorder>verticalSpacer_3</zorder>
<zorder>label_2</zorder>
<zorder>label_side</zorder>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton_3</sender>
<sender>pushButton_cancel</sender>
<signal>clicked()</signal>
<receiver>CompositionsSaverDialog</receiver>
<slot>reject()</slot>
Expand Down
4 changes: 2 additions & 2 deletions Kompozycje/dodajKompozycje.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def __init__(self, parent=None):

self.dodaj_kompozycje.show()
self.usun_kompozycje.show()
self.wczytaj.show()
self.zapisz.show()
self.load.show()
self.save.show()
20 changes: 10 additions & 10 deletions Kompozycje/dodaj_kompozycje.ui
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ QTableView:item:hover {
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_24">
<widget class="QFrame" name="frame_title">
<property name="minimumSize">
<size>
<width>200</width>
Expand Down Expand Up @@ -295,7 +295,7 @@ QTableView:item:hover {
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_23">
<widget class="QFrame" name="frame_main">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down Expand Up @@ -992,7 +992,7 @@ QPushButton:disabled
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="pushButton_side">
<property name="styleSheet">
<string notr="true">QPushButton{
background-color: transparent;
Expand Down Expand Up @@ -1035,7 +1035,7 @@ QPushButton:pressed{
</spacer>
</item>
<item>
<widget class="QPushButton" name="zapisz">
<widget class="QPushButton" name="save">
<property name="styleSheet">
<string notr="true"/>
</property>
Expand All @@ -1045,7 +1045,7 @@ QPushButton:pressed{
</widget>
</item>
<item>
<widget class="QPushButton" name="wczytaj">
<widget class="QPushButton" name="load">
<property name="styleSheet">
<string notr="true">color: #EDF6FC;</string>
</property>
Expand All @@ -1056,9 +1056,9 @@ QPushButton:pressed{
</item>
</layout>
<zorder>verticalSpacer_3</zorder>
<zorder>zapisz</zorder>
<zorder>wczytaj</zorder>
<zorder>pushButton_2</zorder>
<zorder>save</zorder>
<zorder>load</zorder>
<zorder>pushButton_side</zorder>
</widget>
</item>
</layout>
Expand All @@ -1068,8 +1068,8 @@ QPushButton:pressed{
<tabstop>komp_gora</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>pushButton_3</tabstop>
<tabstop>zapisz</tabstop>
<tabstop>wczytaj</tabstop>
<tabstop>save</tabstop>
<tabstop>load</tabstop>
</tabstops>
<resources/>
<connections>
Expand Down
20 changes: 10 additions & 10 deletions Kompozycje/nowa_kompozycja.ui
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ QListView:item:hover {
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="pushButton_save">
<property name="minimumSize">
<size>
<width>120</width>
Expand Down Expand Up @@ -266,7 +266,7 @@ QListView:item:hover {
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="pushButton_cancel">
<property name="minimumSize">
<size>
<width>120</width>
Expand Down Expand Up @@ -297,7 +297,7 @@ QListView:item:hover {
</layout>
</item>
<item row="1" column="1">
<widget class="QFrame" name="frame">
<widget class="QFrame" name="frame_main">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -336,7 +336,7 @@ QAbstractScrollArea:corner{
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1" rowspan="5">
<widget class="QFrame" name="frame_4">
<widget class="QFrame" name="frame_layers">
<property name="styleSheet">
<string notr="true">border: 1px solid #0A0C0D;
border-radius: 10px;
Expand Down Expand Up @@ -550,7 +550,7 @@ QScrollBar:vertical{
</widget>
</item>
<item row="1" column="0" rowspan="5">
<widget class="QFrame" name="frame_2">
<widget class="QFrame" name="frame_groups">
<property name="styleSheet">
<string notr="true">border: 1px solid #0A0C0D;
border-radius: 10px;
Expand Down Expand Up @@ -982,7 +982,7 @@ QListView:item:hover {
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="frame_3">
<widget class="QFrame" name="frame_title">
<property name="minimumSize">
<size>
<width>200</width>
Expand Down Expand Up @@ -1074,7 +1074,7 @@ QFrame {
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="label_side">
<property name="styleSheet">
<string notr="true"> background-color: #b7d3e8;
color: #0A0C0D;
Expand Down Expand Up @@ -1106,13 +1106,13 @@ QFrame {
<tabstop>usun_warstwe</tabstop>
<tabstop>wdol_warstwe</tabstop>
<tabstop>wgore_warstwe</tabstop>
<tabstop>pushButton_2</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>pushButton_save</tabstop>
<tabstop>pushButton_cancel</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<sender>pushButton_cancel</sender>
<signal>clicked()</signal>
<receiver>KompozycjeDialog</receiver>
<slot>reject()</slot>
Expand Down
9 changes: 5 additions & 4 deletions QuickPrint.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ def __init__(self, iface : QgisInterface, parent : QtWidgets=None) -> None:
self.set_font_quickprint(QSettings().value("qgis/stylesheet/fontPointSize"))

def set_font_quickprint(self, font_size):
attributes = [self.dialog.label_2, self.dialog.title_label_7]
attributes = [self.dialog.label_side, self.dialog.title_label,
self.dialog.cancelPushButton, self.dialog.previewPushButton,
self.dialog.savePushButton, self.dialog.calendar]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} font: {font_size}pt;')
self.dialog.frame_4.setStyleSheet(
f'{self.dialog.frame_4.styleSheet()} QGroupBox, QCheckBox, QToolButton, '
self.dialog.frame_main.setStyleSheet(
f'{self.dialog.frame_main.styleSheet()} QGroupBox, QCheckBox, QToolButton, '
f'QLineEdit, QRadioButton, QComboBox, QSpinBox, QProgressBar {{font: {font_size}pt;}}')
self.dialog.calendar.setStyleSheet(f'font: {font_size}pt;')

def setup_rubberband(self) -> None:
self.rubberband = QgsRubberBand(iface.mapCanvas(), QgsWkbTypes.PolygonGeometry)
Expand Down
14 changes: 13 additions & 1 deletion SectionManager/CustomSectionManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

from qgis.PyQt import uic
from qgis.PyQt.QtCore import QModelIndex
from qgis.PyQt.QtCore import QSortFilterProxyModel
from qgis.PyQt.QtCore import QSortFilterProxyModel, QSettings
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem
from qgis.PyQt.QtWidgets import QDialog, QToolBar, QAction
from qgis.utils import iface

from ..utils import STANDARD_TOOLS, unpack_nested_lists, Qt, tr, \
icon_manager, CustomMessageBox, get_tool_label, GIAP_CUSTOM_TOOLS, get_action_from_toolbar, \
find_widget_with_menu_in_toolbar
from ..config import Config

FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'UI/add_section_dialog.ui'))
Expand All @@ -26,6 +27,8 @@ def __init__(self, parent=None, mode=None):
self.main_qgs_widget = parent.parent
self.mode = mode
self.removed_idx = set()
if Config().setts['font_changed']:
self.set_font_custom_section_manager(QSettings().value("qgis/stylesheet/fontPointSize"))
if mode != 'remove':
self.add_available_tools_into_list()
self.find_tool_searchbox.textChanged.connect(
Expand All @@ -36,6 +39,15 @@ def __init__(self, parent=None, mode=None):
self.pushButton_save.clicked.connect(self.save_section)
self.protected = False

def set_font_custom_section_manager(self, font_size) -> None:
attributes = [self.pushButton_save, self.pushButton_cancel, self.title_label]
for attr in attributes:
attr.setStyleSheet(f'{attr.styleSheet()} font: {font_size}pt;')
self.frame_main.setStyleSheet(
f'{self.frame_main.styleSheet()}QFrame, QTableView, QLabel, QLineEdit, '
f'QgsFilterLineEdit {{font: {font_size}pt;}}')


def add_available_tools_into_list(self) -> None:
self.availableToolTable_sort = QSortFilterProxyModel()
model = QStandardItemModel()
Expand Down
4 changes: 2 additions & 2 deletions SectionManager/UI/add_section_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ QTreeView::branch {
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<widget class="QLabel" name="title_label_12">
<widget class="QLabel" name="title_label">
<property name="geometry">
<rect>
<x>8</x>
Expand Down Expand Up @@ -240,7 +240,7 @@ QTreeView::branch {
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_17">
<widget class="QFrame" name="frame_main">
<property name="styleSheet">
<string notr="true"/>
</property>
Expand Down
Loading

0 comments on commit 777a1e6

Please sign in to comment.