- added more key shortcuts into the application; they are now displayed in the GUI menu's

- reorganized the Edit -> Preferences -> Global
- redesigned the messagebox that is showed when quiting ot creating a New Project: now it has an option ('Cancel') to abort the process returning to the app
This commit is contained in:
Marius Stanciu
2019-01-27 03:32:09 +02:00
committed by Marius S
parent c0031235cd
commit c4a9c8bd77
22 changed files with 595 additions and 326 deletions

View File

@@ -141,6 +141,9 @@ class ToolCalculator(FlatCAMTool):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "Calc. Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+C', **kwargs)
def on_calculate_tool_dia(self):
# Calculation:
# Manufacturer gives total angle of the the tip but we need only half of it

View File

@@ -9,7 +9,7 @@ from FlatCAMObj import FlatCAMGeometry, FlatCAMExcellon, FlatCAMGerber
class ToolCutout(FlatCAMTool):
toolName = "Cutout PCB Tool"
toolName = "Cutout PCB"
def __init__(self, app):
FlatCAMTool.__init__(self, app)
@@ -188,6 +188,9 @@ class ToolCutout(FlatCAMTool):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "Cutout Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+U', **kwargs)
def on_freeform_cutout(self):
def subtract_rectangle(obj_, x0, y0, x1, y1):

View File

@@ -8,7 +8,7 @@ from PyQt5 import QtCore
class DblSidedTool(FlatCAMTool):
toolName = "Double-Sided PCB Tool"
toolName = "2-Sided PCB"
def __init__(self, app):
FlatCAMTool.__init__(self, app)
@@ -254,6 +254,9 @@ class DblSidedTool(FlatCAMTool):
self.axis_location.set_value('point')
self.drill_dia.set_value(1)
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+D', **kwargs)
def on_combo_box_type(self):
obj_type = self.box_combo_type.currentIndex()
self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))

View File

@@ -6,7 +6,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets
class Film(FlatCAMTool):
toolName = "Film PCB Tool"
toolName = "Film PCB"
def __init__(self, app):
FlatCAMTool.__init__(self, app)
@@ -154,6 +154,9 @@ class Film(FlatCAMTool):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "Film Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+L', **kwargs)
def on_film_creation(self):
try:
name = self.tf_object_combo.currentText()

View File

@@ -7,12 +7,12 @@ from math import sqrt
class Measurement(FlatCAMTool):
toolName = "Measurement Tool"
toolName = "Measurement"
def __init__(self, app):
FlatCAMTool.__init__(self, app)
self.units = self.app.general_options_form.general_group.units_radio.get_value().lower()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().lower()
## Title
title_label = QtWidgets.QLabel("<font size=4><b>%s</b></font><br>" % self.toolName)
@@ -165,10 +165,13 @@ class Measurement(FlatCAMTool):
# Switch notebook to tool page
self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
self.units = self.app.general_options_form.general_group.units_radio.get_value().lower()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().lower()
self.show()
self.app.ui.notebook.setTabText(2, "Meas. Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='CTRL+M', **kwargs)
def on_key_release_meas(self, event):
if event.key == 'escape':
# abort the measurement action
@@ -217,7 +220,7 @@ class Measurement(FlatCAMTool):
else:
# ENABLE the Measuring TOOL
self.active = True
self.units = self.app.general_options_form.general_group.units_radio.get_value().lower()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().lower()
# we disconnect the mouse/key handlers from wherever the measurement tool was called
if self.app.call_source == 'app':

View File

@@ -31,7 +31,7 @@ class ToolMove(FlatCAMTool):
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene, layers=1)
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, **kwargs)
FlatCAMTool.install(self, icon, separator, shortcut='M', **kwargs)
def run(self):
if self.app.tool_tab_locked is True:

View File

@@ -7,7 +7,7 @@ import time
class NonCopperClear(FlatCAMTool, Gerber):
toolName = "Non-Copper Clearing Tool"
toolName = "Non-Copper Clearing"
def __init__(self, app):
self.app = app
@@ -234,7 +234,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.generate_ncc_button.clicked.connect(self.on_ncc)
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, **kwargs)
FlatCAMTool.install(self, icon, separator, shortcut='ALT+N', **kwargs)
def run(self):
FlatCAMTool.run(self)
@@ -322,13 +322,13 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.obj_name = ""
self.ncc_obj = None
self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"]
self.units = self.app.general_options_form.general_group.units_radio.get_value().upper()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().upper()
def build_ui(self):
self.ui_disconnect()
# updated units
self.units = self.app.general_options_form.general_group.units_radio.get_value().upper()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().upper()
if self.units == "IN":
self.addtool_entry.set_value(0.039)

View File

@@ -5,7 +5,7 @@ from ObjectCollection import *
class ToolPaint(FlatCAMTool, Gerber):
toolName = "Paint Area Tool"
toolName = "Paint Area"
def __init__(self, app):
self.app = app
@@ -290,7 +290,7 @@ class ToolPaint(FlatCAMTool, Gerber):
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, **kwargs)
FlatCAMTool.install(self, icon, separator, shortcut='ALT+P', **kwargs)
def run(self):
FlatCAMTool.run(self)
@@ -327,7 +327,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paintoverlap_entry.set_value(self.default_data["paintoverlap"])
# updated units
self.units = self.app.general_options_form.general_group.units_radio.get_value().upper()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().upper()
if self.units == "IN":
self.addtool_entry.set_value(0.039)
@@ -390,7 +390,7 @@ class ToolPaint(FlatCAMTool, Gerber):
pass
# updated units
self.units = self.app.general_options_form.general_group.units_radio.get_value().upper()
self.units = self.app.general_options_form.general_app_group.units_radio.get_value().upper()
sorted_tools = []
for k, v in self.paint_tools.items():

View File

@@ -6,7 +6,7 @@ import time
class Panelize(FlatCAMTool):
toolName = "Panelize PCB Tool"
toolName = "Panelize PCB"
def __init__(self, app):
super(Panelize, self).__init__(self)
@@ -197,6 +197,9 @@ class Panelize(FlatCAMTool):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "Panel. Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+Z', **kwargs)
def on_panelize(self):
name = self.object_combo.currentText()

View File

@@ -53,6 +53,9 @@ class Properties(FlatCAMTool):
FlatCAMTool.run(self)
self.properties()
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='P', **kwargs)
def properties(self):
obj_list = self.app.collection.get_selected()
if not obj_list:
@@ -86,10 +89,10 @@ class Properties(FlatCAMTool):
width = abs(ymax - ymin)
self.addChild(dims, ['Length:', '%.4f %s' % (
length, self.app.general_options_form.general_group.units_radio.get_value().lower())], True)
length, self.app.general_options_form.general_app_group.units_radio.get_value().lower())], True)
self.addChild(dims, ['Width:', '%.4f %s' % (
width, self.app.general_options_form.general_group.units_radio.get_value().lower())], True)
if self.app.general_options_form.general_group.units_radio.get_value().lower() == 'mm':
width, self.app.general_options_form.general_app_group.units_radio.get_value().lower())], True)
if self.app.general_options_form.general_app_group.units_radio.get_value().lower() == 'mm':
area = (length * width) / 100
self.addChild(dims, ['Box Area:', '%.4f %s' % (area, 'cm2')], True)
else:

View File

@@ -370,6 +370,9 @@ class ToolTransform(FlatCAMTool):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "Transform Tool")
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+R', **kwargs)
def on_rotate(self):
try:
value = float(self.rotate_entry.get_value())