- some PEP8 cleanup

This commit is contained in:
Marius Stanciu
2019-06-09 17:39:42 +03:00
parent 3bd2957739
commit f4f7b65080
3 changed files with 27 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import sys, os import sys
import os
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings, Qt from PyQt5.QtCore import QSettings, Qt
@@ -10,22 +11,22 @@ if sys.platform == "win32":
# cx_freeze 'module win32' workaround # cx_freeze 'module win32' workaround
pass pass
def debug_trace(): def debug_trace():
""" """
Set a tracepoint in the Python debugger that works with Qt Set a tracepoint in the Python debugger that works with Qt
:return: None :return: None
""" """
from PyQt5.QtCore import pyqtRemoveInputHook from PyQt5.QtCore import pyqtRemoveInputHook
#from pdb import set_trace # from pdb import set_trace
pyqtRemoveInputHook() pyqtRemoveInputHook()
#set_trace() # set_trace()
# All X11 calling should be thread safe otherwise we have strange issues
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
# NOTE: Never talk to the GUI from threads! This is why I commented the above.
if __name__ == '__main__': if __name__ == '__main__':
# All X11 calling should be thread safe otherwise we have strange issues
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
# NOTE: Never talk to the GUI from threads! This is why I commented the above.
freeze_support() freeze_support()
debug_trace() debug_trace()
@@ -59,4 +60,3 @@ if __name__ == '__main__':
fc = App() fc = App()
sys.exit(app.exec_()) sys.exit(app.exec_())

View File

@@ -1,10 +1,10 @@
# ######################################################### ## # ###########################################################
# FlatCAM: 2D Post-processing for Manufacturing # # FlatCAM: 2D Post-processing for Manufacturing #
# http://flatcam.org # # http://flatcam.org #
# Author: Juan Pablo Caram (c) # # Author: Juan Pablo Caram (c) #
# Date: 2/5/2014 # # Date: 2/5/2014 #
# MIT Licence # # MIT Licence #
# ######################################################### ## # ###########################################################
import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.parse, urllib.error
import getopt import getopt
@@ -25,9 +25,9 @@ import gc
from xml.dom.minidom import parseString as parse_xml_string from xml.dom.minidom import parseString as parse_xml_string
# ##################################### ## # #######################################
# # Imports part of FlatCAM # ## # # Imports part of FlatCAM ##
# ##################################### ## # #######################################
from ObjectCollection import * from ObjectCollection import *
from FlatCAMObj import * from FlatCAMObj import *
from flatcamGUI.PlotCanvas import * from flatcamGUI.PlotCanvas import *
@@ -875,7 +875,7 @@ class App(QtCore.QObject):
"tools_calc_vshape_cut_z": 0.000787, "tools_calc_vshape_cut_z": 0.000787,
"tools_calc_electro_length": 10.0, "tools_calc_electro_length": 10.0,
"tools_calc_electro_width": 10.0, "tools_calc_electro_width": 10.0,
"tools_calc_electro_cdensity":13.0, "tools_calc_electro_cdensity": 13.0,
"tools_calc_electro_growth": 10.0, "tools_calc_electro_growth": 10.0,
"tools_transform_rotate": 90, "tools_transform_rotate": 90,
@@ -929,10 +929,9 @@ class App(QtCore.QObject):
self.ui.general_defaults_form.general_app_group.language_cb.setCurrentText(ret_val) self.ui.general_defaults_form.general_app_group.language_cb.setCurrentText(ret_val)
log.debug("App.__init__() --> Applied %s language." % str(ret_val).capitalize()) log.debug("App.__init__() --> Applied %s language." % str(ret_val).capitalize())
# ##################################
# ################################ ## # ### CREATE UNIQUE SERIAL NUMBER ##
# # ## CREATE UNIQUE SERIAL NUMBER # ## # ##################################
# ################################ ##
chars = 'abcdefghijklmnopqrstuvwxyz0123456789' chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
if self.defaults['global_serial'] == 0 or len(str(self.defaults['global_serial'])) < 10: if self.defaults['global_serial'] == 0 or len(str(self.defaults['global_serial'])) < 10:
@@ -2790,7 +2789,7 @@ class App(QtCore.QObject):
self.inform.emit(_("[ERROR_NOTCL] Failed to parse defaults file.")) self.inform.emit(_("[ERROR_NOTCL] Failed to parse defaults file."))
return return
self.defaults.update(defaults_from_file) self.defaults.update(defaults_from_file)
self.inform.emit(_("[success] Imported Defaults from %s") %filename) self.inform.emit(_("[success] Imported Defaults from %s") % filename)
def on_export_preferences(self): def on_export_preferences(self):
self.report_usage("on_export_preferences") self.report_usage("on_export_preferences")
@@ -2802,16 +2801,16 @@ class App(QtCore.QObject):
self.date = ''.join(c for c in self.date if c not in ':-') self.date = ''.join(c for c in self.date if c not in ':-')
self.date = self.date.replace(' ', '_') self.date = self.date.replace(' ', '_')
filter = "Config File (*.FlatConfig);;All Files (*.*)" filter__ = "Config File (*.FlatConfig);;All Files (*.*)"
try: try:
filename, _f = QtWidgets.QFileDialog.getSaveFileName( filename, _f = QtWidgets.QFileDialog.getSaveFileName(
caption=_("Export FlatCAM Preferences"), caption=_("Export FlatCAM Preferences"),
directory=self.data_path + '/preferences_' + self.date, directory=self.data_path + '/preferences_' + self.date,
filter=filter filter=filter__
) )
except TypeError: except TypeError:
filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export FlatCAM Preferences"), filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export FlatCAM Preferences"),
filter=filter) filter=filter__)
filename = str(filename) filename = str(filename)
defaults_from_file = {} defaults_from_file = {}

View File

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
- updated translations - updated translations
- fixed the the labels for shortcut keys for zoom in and zoom out both in the Menu links and in the Shortcut list - fixed the the labels for shortcut keys for zoom in and zoom out both in the Menu links and in the Shortcut list
- made sure the zoom functions use the global_zoom_ratio parameter from App.self.defaults dictionary. - made sure the zoom functions use the global_zoom_ratio parameter from App.self.defaults dictionary.
- some PEP8 cleanup
8.06.2019 8.06.2019