- more changes due of porting to PyQt6

- fixed the Autocompleter highlighting to work in PyQt6
This commit is contained in:
Marius Stanciu
2021-08-07 10:21:45 +03:00
committed by Marius
parent 03618172d7
commit 3c06280d3d
11 changed files with 100 additions and 55 deletions

View File

@@ -617,7 +617,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.ui.treeWidget.clear()
self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored,
QtWidgets.QSizePolicy.Policy.MinimumExpanding)
# make sure that the FCTree widget columns are resized to content
self.ui.treeWidget.resize_sig.emit()
@@ -1313,7 +1314,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
dia_plot = float(self.options["tools_mill_tooldia"])
except ValueError:
# we may have a tuple with only one element and a comma
dia_plot = [float(el) for el in self.options["tools_mill_tooldia"].split(',') if el != ''][0]
dia_plot = [
float(el) for el in self.options["tools_mill_tooldia"].split(',') if el != ''
][0]
self.plot2(tooldia=dia_plot, obj=self, visible=visible, kind=kind)
else:
@@ -1328,7 +1331,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
if not gcode_parsed:
continue
# gcode_parsed = self.gcode_parsed
self.plot2(tooldia=dia_plot, obj=self, visible=visible, gcode_parsed=gcode_parsed, kind=kind)
self.plot2(tooldia=dia_plot, obj=self, visible=visible, gcode_parsed=gcode_parsed,
kind=kind)
else:
# multiple tools usage
if self.tools:
@@ -1338,7 +1342,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.decimals
)
gcode_parsed = self.tools[tooluid_key]['gcode_parsed']
self.plot2(tooldia=dia_plot, obj=self, visible=visible, gcode_parsed=gcode_parsed, kind=kind)
self.plot2(tooldia=dia_plot, obj=self, visible=visible, gcode_parsed=gcode_parsed,
kind=kind)
self.shapes.redraw()
except (ObjectDeleted, AttributeError):

View File

@@ -136,7 +136,7 @@ class DocumentObject(FlatCAMObj):
# self.document_editor_tab.handleTextChanged()
self.ser_attrs = ['options', 'kind', 'source_file']
if Qt.mightBeRichText(self.source_file):
if QtGui.Qt.mightBeRichText(self.source_file):
# self.document_editor_tab.code_editor.setHtml(self.source_file)
self.document_editor_tab.load_text(self.source_file, move_to_start=True, clear_text=True, as_html=True)
else:
@@ -245,10 +245,10 @@ class DocumentObject(FlatCAMObj):
def on_bold_button(self):
if self.ui.font_bold_tb.isChecked():
self.document_editor_tab.code_editor.setFontWeight(QtGui.QFont.Bold)
self.document_editor_tab.code_editor.setFontWeight(QtGui.QFont.Weight.Bold)
self.font_bold = True
else:
self.document_editor_tab.code_editor.setFontWeight(QtGui.QFont.Normal)
self.document_editor_tab.code_editor.setFontWeight(QtGui.QFont.Weight.Normal)
self.font_bold = False
def on_italic_button(self):

View File

@@ -674,7 +674,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
self.ui.treeWidget.clear()
self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored,
QtWidgets.QSizePolicy.Policy.MinimumExpanding)
# make sure that the FCTree widget columns are resized to content
self.ui.treeWidget.resize_sig.emit()
@@ -751,7 +752,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
exc_x_formatted = exc_x_formatted.partition('.')
exc_y_formatted = exc_y_formatted.partition('.')
# left padd the 'whole' part with zeros
# left pad the 'whole' part with zeros
x_whole = exc_x_formatted[0].rjust(whole, 0)
y_whole = exc_y_formatted[0].rjust(whole, 0)
@@ -824,7 +825,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
stop_slot_x_formatted = stop_slot_x_formatted.partition('.')
stop_slot_y_formatted = stop_slot_y_formatted.partition('.')
# left padd the 'whole' part with zeros
# left pad the 'whole' part with zeros
start_x_whole = start_slot_x_formatted[0].rjust(whole, 0)
start_y_whole = start_slot_y_formatted[0].rjust(whole, 0)
stop_x_whole = stop_slot_x_formatted[0].rjust(whole, 0)

View File

@@ -376,8 +376,9 @@ class GeometryObject(FlatCAMObj, Geometry):
# # End Build Exclusion Areas
# # -----------------------------
#
# # HACK: for whatever reasons the name in Selected tab is reverted to the original one after a successful rename
# # done in the collection view but only for Geometry objects. Perhaps some references remains. Should be fixed.
# # HACK: for whatever reasons the name in Selected tab is reverted to the original one after a successful
# rename done in the collection view but only for Geometry objects. Perhaps some references remains.
# Should be fixed.
# self.ui.name_entry.set_value(self.options['name'])
# self.ui_connect()
#
@@ -680,7 +681,8 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.treeWidget.clear()
self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding)
self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored,
QtWidgets.QSizePolicy.Policy.MinimumExpanding)
# make sure that the FCTree widget columns are resized to content
self.ui.treeWidget.resize_sig.emit()
@@ -705,8 +707,8 @@ class GeometryObject(FlatCAMObj, Geometry):
for geo in flattened_geo:
if geo.geom_type == 'Polygon':
vertex_points += len(list(geo.exterior.coords))
for int in geo.interiors:
vertex_points += len(list(int.coords))
for inter in geo.interiors:
vertex_points += len(list(inter.coords))
if geo.geom_type in ['LineString', 'LinearRing']:
vertex_points += len(list(geo.coords))
@@ -2144,7 +2146,6 @@ class GeometryObject(FlatCAMObj, Geometry):
:param outname:
:param tools_dict: a dictionary that holds the whole data needed to create the Gcode
(including the solid_geometry)
:param tools_in_use: the tools that are used, needed by some preprocessors
:param segx: number of segments on the X axis, for auto-levelling
:param segy: number of segments on the Y axis, for auto-levelling
:param plot: if True the generated object will be plotted; if False will not be plotted

View File

@@ -10,7 +10,7 @@
# File modified by: Marius Stanciu #
# ##########################################################
import inspect # TODO: For debugging only.
# import inspect # TODO: For debugging only.
from appGUI.ObjectUI import *

View File

@@ -226,6 +226,7 @@ class TreeItem(KeySensitiveListView):
except AttributeError:
pass
class ObjectCollection(QtCore.QAbstractItemModel):
"""
Object storage and management.