Procházet zdrojové kódy

- added new settings in Edit -> Preferences -> General for Notebook Font size (set font size for the items in Project Tree and for text in Selected Tab) and for canvas Axis font size. The values are stored in QSettings.
- updated translations

Marius Stanciu před 6 roky
rodič
revize
0686e77f99

+ 34 - 10
FlatCAMApp.py

@@ -363,6 +363,7 @@ class App(QtCore.QObject):
             "global_layout": self.ui.general_defaults_form.general_gui_set_group.layout_combo,
             "global_hover": self.ui.general_defaults_form.general_gui_set_group.hover_cb,
             "global_selection_shape": self.ui.general_defaults_form.general_gui_set_group.selection_cb,
+
             # Gerber General
             "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
             "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
@@ -690,6 +691,7 @@ class App(QtCore.QObject):
             "global_def_win_w": 1024,
             "global_def_win_h": 650,
             "global_def_notebook_width": 1,
+
             # Constants...
             "global_defaults_save_period_ms": 20000,  # Time between default saves.
             "global_shell_shape": [500, 300],  # Shape of the shell in pixels.
@@ -708,6 +710,7 @@ class App(QtCore.QObject):
             "global_hover": False,
             "global_selection_shape": True,
             "global_layout": "compact",
+
             # Gerber General
             "gerber_plot": True,
             "gerber_solid": True,
@@ -3511,6 +3514,10 @@ class App(QtCore.QObject):
         settings.setValue('saved_gui_state', self.ui.saveState())
         settings.setValue('maximized_gui', self.ui.isMaximized())
         settings.setValue('language', self.ui.general_defaults_form.general_app_group.language_cb.get_value())
+        settings.setValue('notebook_font_size',
+                          self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value())
+        settings.setValue('axis_font_size',
+                          self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value())
 
         # This will write the setting to the platform specific storage.
         del settings
@@ -4616,6 +4623,18 @@ class App(QtCore.QObject):
         # Re-fresh project options
         self.on_options_app2project()
 
+        # save the notebook font size
+        settings = QSettings("Open Source", "FlatCAM")
+        fsize = self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value()
+        settings.setValue('notebook_font_size', fsize)
+
+        # save the axis font size
+        g_fsize = self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value()
+        settings.setValue('axis_font_size', g_fsize)
+
+        # This will write the setting to the platform specific storage.
+        del settings
+
     def handlePrint(self):
         self.report_usage("handlePrint()")
 
@@ -5344,7 +5363,7 @@ class App(QtCore.QObject):
 
             if response == bt_yes:
                 self.on_save_button()
-                self.inform.emit(_("[success] Defaults saved."))
+                self.inform.emit(_("[success] Preferences saved."))
             else:
                 self.preferences_changed_flag = False
                 return
@@ -8613,22 +8632,27 @@ class App(QtCore.QObject):
             _('<b>Shortcut Key List</b>'))
         sel_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
         sel_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
-        # font = self.sel_title.font()
-        # font.setPointSize(12)
-        # self.sel_title.setFont(font)
+
+        settings = QSettings("Open Source", "FlatCAM")
+        if settings.contains("notebook_font_size"):
+            fsize = settings.value('notebook_font_size', type=int)
+        else:
+            fsize = 12
+
+        tsize = fsize + int(fsize / 2)
 
         selected_text = _('''
-<p><span style="font-size:14px"><strong>Selected Tab - Choose an Item from Project Tab</strong></span></p>
+<p><span style="font-size:{tsize}px"><strong>Selected Tab - Choose an Item from Project Tab</strong></span></p>
 
-<p><span style="font-size:10px"><strong>Details</strong>:<br />
+<p><span style="font-size:{fsize}px"><strong>Details</strong>:<br />
 The normal flow when working in FlatCAM is the following:</span></p>
 
 <ol>
-	<li><span style="font-size:10px">Loat/Import a Gerber, Excellon, Gcode, DXF, Raster Image or SVG file into FlatCAM using either the menu&#39;s, toolbars, key shortcuts or even dragging and dropping the files on the GUI.<br />
+	<li><span style="font-size:{fsize}px">Loat/Import a Gerber, Excellon, Gcode, DXF, Raster Image or SVG file into FlatCAM using either the menu&#39;s, toolbars, key shortcuts or even dragging and dropping the files on the GUI.<br />
 	<br />
 	You can also load a <strong>FlatCAM project</strong> by double clicking on the project file, drag &amp; drop of the file into the FLATCAM GUI or through the menu/toolbar links offered within the app.</span><br />
 	&nbsp;</li>
-	<li><span style="font-size:10px">Once an object is available in the Project Tab, by selecting it and then focusing on <strong>SELECTED TAB </strong>(more simpler is to double click the object name in the Project Tab), <strong>SELECTED TAB </strong>will be updated with the object properties according to it&#39;s kind: Gerber, Excellon, Geometry or CNCJob object.<br />
+	<li><span style="font-size:{fsize}px">Once an object is available in the Project Tab, by selecting it and then focusing on <strong>SELECTED TAB </strong>(more simpler is to double click the object name in the Project Tab), <strong>SELECTED TAB </strong>will be updated with the object properties according to it&#39;s kind: Gerber, Excellon, Geometry or CNCJob object.<br />
 	<br />
 	If the selection of the object is done on the canvas by single click instead, and the <strong>SELECTED TAB</strong> is in focus, again the object properties will be displayed into the Selected Tab. Alternatively, double clicking on the object on the canvas will bring the <strong>SELECTED TAB</strong> and populate it even if it was out of focus.<br />
 	<br />
@@ -8637,9 +8661,9 @@ The normal flow when working in FlatCAM is the following:</span></p>
 	<strong>Gerber/Excellon Object</strong> -&gt; Change Param -&gt; Generate Geometry -&gt;<strong> Geometry Object </strong>-&gt; Add tools (change param in Selected Tab) -&gt; Generate CNCJob -&gt;<strong> CNCJob Object </strong>-&gt; Verify GCode (through Edit CNC Code) and/or append/prepend to GCode (again, done in <strong>SELECTED TAB)&nbsp;</strong>-&gt; Save GCode</span></li>
 </ol>
 
-<p><span style="font-size:10px">A list of key shortcuts is available through an menu entry in <strong>Help -&gt; Shortcuts List</strong>&nbsp;or through it&#39;s own key shortcut: <strng>F3</strong>.</span></p>
+<p><span style="font-size:{fsize}px">A list of key shortcuts is available through an menu entry in <strong>Help -&gt; Shortcuts List</strong>&nbsp;or through it&#39;s own key shortcut: <strng>F3</strong>.</span></p>
 
-        ''')
+        '''.format(fsize=fsize, tsize=tsize))
 
         sel_title.setText(selected_text)
         sel_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)

+ 8 - 2
ObjectCollection.py

@@ -15,7 +15,7 @@ from FlatCAMObj import *
 import inspect  # TODO: Remove
 import FlatCAMApp
 from PyQt5 import QtGui, QtCore, QtWidgets
-from PyQt5.QtCore import Qt
+from PyQt5.QtCore import Qt, QSettings
 # import webbrowser
 
 import gettext
@@ -256,8 +256,14 @@ class ObjectCollection(QtCore.QAbstractItemModel):
         # self.view.setAcceptDrops(True)
         # self.view.setDropIndicatorShown(True)
 
+        settings = QSettings("Open Source", "FlatCAM")
+        if settings.contains("notebook_font_size"):
+            fsize = settings.value('notebook_font_size', type=int)
+        else:
+            fsize = 12
+
         font = QtGui.QFont()
-        font.setPixelSize(12)
+        font.setPixelSize(fsize)
         font.setFamily("Seagoe UI")
         self.view.setFont(font)
 

+ 2 - 0
README.md

@@ -13,6 +13,8 @@ CAD program, and create G-Code for Isolation routing.
 
 - added new option in ToolSub: the ability to close (or not) the resulting paths when using tool on Geometry objects. Added also a new category in the Edit -> Preferences -> Tools, the Substractor Tool Options
 - some PEP8 changes in FlatCAMApp.py
+- added new settings in Edit -> Preferences -> General for Notebook Font size (set font size for the items in Project Tree and for text in Selected Tab) and for canvas Axis font size. The values are stored in QSettings.
+- updated translations
 
 12.08.2019
 

+ 36 - 0
flatcamGUI/FlatCAMGUI.py

@@ -3717,6 +3717,38 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
         )
         self.selection_cb = FCCheckBox()
 
+        self.notebook_font_size_label = QtWidgets.QLabel(_('NB Font Size:'))
+        self.notebook_font_size_label.setToolTip(
+            _("This sets the font size for the elements found in the Notebook.\n"
+              "The notebook is the collapsible area in the left side of the GUI,\n"
+              "and include the Project, Selected and Tool tabs.")
+        )
+
+        self.notebook_font_size_spinner = FCSpinner()
+        self.notebook_font_size_spinner.setRange(8, 40)
+        self.notebook_font_size_spinner.setWrapping(True)
+
+        settings = QSettings("Open Source", "FlatCAM")
+        if settings.contains("notebook_font_size"):
+            self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
+        else:
+            self.notebook_font_size_spinner.set_value(12)
+
+        self.axis_font_size_label = QtWidgets.QLabel(_('Axis Font Size:'))
+        self.axis_font_size_label.setToolTip(
+            _("This sets the font size for canvas axis.")
+        )
+
+        self.axis_font_size_spinner = FCSpinner()
+        self.axis_font_size_spinner.setRange(8, 40)
+        self.axis_font_size_spinner.setWrapping(True)
+
+        settings = QSettings("Open Source", "FlatCAM")
+        if settings.contains("axis_font_size"):
+            self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
+        else:
+            self.axis_font_size_spinner.set_value(8)
+
         # Just to add empty rows
         self.spacelabel = QtWidgets.QLabel('')
 
@@ -3729,6 +3761,10 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
         self.form_box.addRow(self.clear_label, self.clear_btn)
         self.form_box.addRow(self.hover_label, self.hover_cb)
         self.form_box.addRow(self.selection_label, self.selection_cb)
+        self.form_box.addRow(QtWidgets.QLabel(''))
+        self.form_box.addRow(self.notebook_font_size_label, self.notebook_font_size_spinner)
+        self.form_box.addRow(self.axis_font_size_label, self.axis_font_size_spinner)
+
 
         # Add the QFormLayout that holds the Application general defaults
         # to the main layout of this TAB

+ 13 - 5
flatcamGUI/VisPyCanvas.py

@@ -8,12 +8,13 @@
 
 import numpy as np
 from PyQt5.QtGui import QPalette
+from PyQt5.QtCore import QSettings
 import vispy.scene as scene
 from vispy.scene.cameras.base_camera import BaseCamera
 from vispy.color import Color
 import time
 
-white = Color("#ffffff" )
+white = Color("#ffffff")
 black = Color("#000000")
 
 
@@ -35,12 +36,19 @@ class VisPyCanvas(scene.SceneCanvas):
         top_padding = self.grid_widget.add_widget(row=0, col=0, col_span=2)
         top_padding.height_max = 0
 
-        self.yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=8)
+        settings = QSettings("Open Source", "FlatCAM")
+        if settings.contains("axis_font_size"):
+            a_fsize = settings.value('axis_font_size', type=int)
+        else:
+            a_fsize = 8
+
+        self.yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=a_fsize)
         self.yaxis.width_max = 55
         self.grid_widget.add_widget(self.yaxis, row=1, col=0)
 
-        self.xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=8)
-        self.xaxis.height_max = 25
+        self.xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=a_fsize,
+                                      anchors=['center', 'bottom'])
+        self.xaxis.height_max = 30
         self.grid_widget.add_widget(self.xaxis, row=2, col=1)
 
         right_padding = self.grid_widget.add_widget(row=0, col=2, row_span=2)
@@ -48,7 +56,7 @@ class VisPyCanvas(scene.SceneCanvas):
         right_padding.width_max = 0
 
         view = self.grid_widget.add_view(row=1, col=1, border_color='black', bgcolor='white')
-        view.camera = Camera(aspect=1, rect=(-25,-25,150,150))
+        view.camera = Camera(aspect=1, rect=(-25, -25, 150, 150))
 
         # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
         # it is necessary to call manually

binární
locale/de/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 206 - 202
locale/de/LC_MESSAGES/strings.po


binární
locale/en/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 207 - 202
locale/en/LC_MESSAGES/strings.po


binární
locale/es/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 206 - 202
locale/es/LC_MESSAGES/strings.po


binární
locale/pt_BR/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 206 - 202
locale/pt_BR/LC_MESSAGES/strings.po


binární
locale/ro/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 206 - 202
locale/ro/LC_MESSAGES/strings.po


binární
locale/ru/LC_MESSAGES/strings.mo


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 205 - 201
locale/ru/LC_MESSAGES/strings.po


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 232 - 228
locale_template/strings.pot


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů