-
Notifications
You must be signed in to change notification settings - Fork 0
/
Marlin.py
2999 lines (2509 loc) · 156 KB
/
Marlin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import sys
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5.QtWidgets import QApplication, QPushButton, QMessageBox, QWidget, QLabel
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
import webbrowser
import os
import shutil
from os import path
import fileinput
import configparser
from configparser import SafeConfigParser
import io
import re
import Sanity_Check
from Sanity_Check import read_environments, read_boards, read_drivers
from Config import configfile, default_envs, motherboard, serial_port, baudrate, serial_port_2, serial_port_3, x_motors, y_motors, z_motors, extruders
from Config import x_driver_type, x2_driver_type, y_driver_type, y2_driver_type, z_driver_type, z2_driver_type, z3_driver_type, z4_driver_type, \
e0_driver_type, e1_driver_type, e2_driver_type, e3_driver_type, e4_driver_type, e5_driver_type, e6_driver_type, e7_driver_type
from Config import temp_sensor_0, temp_sensor_1, temp_sensor_2, temp_sensor_3, temp_sensor_4, temp_sensor_5, \
temp_sensor_6, temp_sensor_bed, hotend_overshoot, bed_overshoot, cooler_overshoot
from Config import use_xmin_plug, use_ymin_plug, use_zmin_plug, use_xmax_plug, use_ymax_plug, use_zmax_plug, \
xmin_endstop_invert, ymin_endstop_invert, zmin_endstop_invert, xmax_endstop_invert, ymax_endstop_invert, zmax_endstop_invert, zprobe_invert
from Config import xsteps_per_unit, ysteps_per_unit, zsteps_per_unit,e0steps_per_unit, x_max_feedrate, y_max_feedrate, z_max_feedrate, e0_max_feedrate, \
x_max_acceleration, y_max_acceleration, z_max_acceleration, e0_max_acceleration, \
invert_x_dir, invert_y_dir, invert_z_dir, invert_e0_dir, x_homing_position, y_homing_position, z_homing_position
from Config import x_bed_size, y_bed_size, x_min_position, y_min_position, z_height
from Config import z_min_uses_zendstop_pin, use_probe_for_z_homing, use_fixed_mounted_probe, use_nozzle_as_probe, use_bltouch, use_sensorless_probing, \
probing_margin, use_multiple_probing, use_extra_probing, probe_x_offset, probe_y_offset, probe_z_offset, use_probing_heaters_off, \
use_preheat_before_home, use_z_safe_homing
from Config import leveling_3point, leveling_linear, leveling_bilinear, leveling_ubl, leveling_mesh, \
linear_points, ubl_points, mesh_points, restore_after_g28, preheat_before_level, g26_mesh_validation, lcd_bed_levelling
from Config import use_single_nozzle, use_switching_extruder, use_switching_nozzle,use_parking_extruder, use_mixing_extruder, \
mixing_extruder_no, nozzle_park_feature, nozzle_clean_feature
from Config import use_psu_conrol, psu_state, wait_for_cooldown, auto_power_control, power_timeout, poweroff_temparature, display_type, printer_type
from Config import enable_eeprom, reset_on_errors, clear_old_values, use_print_counter, use_sd_support, individial_home_menu, \
use_speaker, use_filament_sensor, filament_sensor_state
from Config import extruder_runout_prevent, use_controller_fan, fast_pwm_fan, extruder_auto_fan_temp, use_bltouch_high_speed, use_z_steppers_auto_align, \
use_adaptive_step_smoothing, use_powerloss_recovery
from Config import use_linear_advance, linear_advance_kfactor, use_g29_retry_recover, long_filename_support, scroll_long_filename
from Config import enable_baby_stepping, inegrated_baby_stepping, baby_step_without_homing, baby_step_always_available, baby_step_on_xy
from Config import enable_dual_x_carriage, dualx_x2_min_position, dualx_x2_max_position, dualx_duplication_offset, advanced_pause_feature, monitor_driver_status
from Config import enable_x_input_shapping, x_input_shapping_frequency, x_input_shapping_zeta, enable_y_input_shapping, y_input_shapping_frequency, y_input_shapping_zeta
from Config import x_current, x_micro_steps, x_rense, x2_current, x2_micro_steps, x2_rense, y_current, y_micro_steps, y_rense, y2_current, y2_micro_steps, \
y2_rense, z_current, z_micro_steps, z_rense, z2_current, z2_micro_steps, z2_rense, z3_current, z3_micro_steps, z3_rense, z4_current, z4_micro_steps, z4_rense
from Config import tx_buffer_size, use_emergency_parcer, use_advanced_ok, sensorless_homing, use_tmc_debugging, chopper_voltage
from Config import e0_current, e0_micro_steps, e0_rense, e1_current, e1_micro_steps, e1_rense, e2_current, e2_micro_steps, e2_rense
from Config import e3_current, e3_micro_steps, e3_rense, e4_current, e4_micro_steps, e4_rense, e5_current, e5_micro_steps, e5_rense
from Config import e6_current, e6_micro_steps, e6_rense, e7_current, e7_micro_steps, e7_rense
SourceDir = "Original Configs/"
Modified = str(" //Modified ")
config = configparser.ConfigParser(allow_no_value=True)
config.read(configfile)
class MyWindow(QtWidgets.QDialog):
def __init__(self):
super(MyWindow,self).__init__()
uic.loadUi('Marlin.ui',self)
#QtWidgets.QComboBox.findText
#self.Environment.clear()
#Add all Environments to combobox
self.Environments = read_environments()
for Environments in self.Environments:
self.Environment.addItem(Environments)
self.Environment.setItemText(0, default_envs) # Set Default Environment from Config.ini file
#Add all Motherboards to combobox
self.Boards = read_boards()
for Boards in self.Boards:
self.BoardTxt.addItem(Boards)
self.BoardTxt.setItemText(0, motherboard) # Show motherboard from Config.ini file
#Add all Drivers to combobox
self.Drivers = read_drivers()
for Drivers in self.Drivers:
self.X_Driver.addItem(Drivers)
self.X2_Driver.addItem(Drivers)
self.Y_Driver.addItem(Drivers)
self.Y2_Driver.addItem(Drivers)
self.Z_Driver.addItem(Drivers)
self.Z2_Driver.addItem(Drivers)
self.Z3_Driver.addItem(Drivers)
self.Z4_Driver.addItem(Drivers)
self.E0_Driver.addItem(Drivers)
self.E1_Driver.addItem(Drivers)
self.E2_Driver.addItem(Drivers)
self.E3_Driver.addItem(Drivers)
self.E4_Driver.addItem(Drivers)
self.E5_Driver.addItem(Drivers)
self.E6_Driver.addItem(Drivers)
self.E7_Driver.addItem(Drivers)
self.X_Driver.setItemText(0, x_driver_type)
self.X2_Driver.setItemText(0, x2_driver_type)
self.Y_Driver.setItemText(0, y_driver_type)
self.Y2_Driver.setItemText(0, y2_driver_type)
self.Z_Driver.setItemText(0, z_driver_type)
self.Z2_Driver.setItemText(0, z2_driver_type)
self.Z3_Driver.setItemText(0, z3_driver_type)
self.Z4_Driver.setItemText(0, z4_driver_type)
self.E0_Driver.setItemText(0, e0_driver_type)
self.E1_Driver.setItemText(0, e1_driver_type)
self.E2_Driver.setItemText(0, e2_driver_type)
self.E3_Driver.setItemText(0, e3_driver_type)
self.E4_Driver.setItemText(0, e4_driver_type)
self.E5_Driver.setItemText(0, e5_driver_type)
self.E6_Driver.setItemText(0, e6_driver_type)
self.E7_Driver.setItemText(0, e7_driver_type)
self.Serial0.setCurrentText(serial_port)
if serial_port_2 != "none" :
self.Serial2.setCurrentText(serial_port_2)
if serial_port_3 != "none" :
self.Serial3.setCurrentText(serial_port_3)
self.BaudRate.setCurrentText(baudrate)
self.XMotorsNo.setCurrentText(x_motors)
self.YMotorsNo.setCurrentText(y_motors)
self.ZMotorsNo.setCurrentText(z_motors)
self.Extruders.setCurrentText(extruders)
#Sanity_Check.Conditions() # Need to Seperate below conditions to Sanity_Check.py file
self.MixingSteppers.setEnabled(False) # Disable Mixing Steppers by default
self.PSUState.setEnabled(False) # Disable PSU state by default
self.WaitForCool.setEnabled(False) # Disable PSU Wait for Cool by default
self.AuPowControl.setEnabled(False) # Disable PSU Auto Power Control by default
self.PowerTimeOut.setEnabled(False) # Disable PSU Timeout by default
self.PowerOffTemp.setEnabled(False) # Disable PSU Poer off Temparature by default
self.XMotorsNo.currentTextChanged.connect(self.XMotorsNo_changed)
self.YMotorsNo.currentTextChanged.connect(self.YMotorsNo_changed)
self.ZMotorsNo.currentTextChanged.connect(self.ZMotorsNo_changed)
self.Extruders.currentTextChanged.connect(self.extruders_changed)
#~~~~~~~~~~~~~~ Levelling Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.LinearPoints.setEnabled(False) # Disable Linear Points by default
self.UBLLevelPoints.setEnabled(True) # Enable UBL Points by default
self.MeshLevelPoints.setEnabled(False) # Disable Mesh Points by default
self.LinearPoints.setText("")
self.MeshLevelPoints.setText("")
self.Level3Point.toggled.connect(self.check_levelState)
self.Linear.toggled.connect(self.check_levelState)
self.BiLinear.toggled.connect(self.check_levelState)
self.UBL.toggled.connect(self.check_levelState)
self.MeshBed.toggled.connect(self.check_levelState)
self.LevelHelpBtn.clicked.connect(self.OpenLevelHelpUrl)
#~~~~~~~~~~~~~~ Probe Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.MultipleProbing.stateChanged.connect(self.check_Probing)
self.ZHelpBtn.clicked.connect(self.OpenZHelpUrl)
# ~~~~~~~~~~~~~~ Endstops Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.UseXMinPlug.stateChanged.connect(self.check_xmin_endstop)
self.UseYMinPlug.stateChanged.connect(self.check_ymin_endstop)
self.UseZMinPlug.stateChanged.connect(self.check_zmin_endstop)
self.UseXMinPlug.stateChanged.connect(self.check_xmin_endstop)
self.UseXMaxPlug.stateChanged.connect(self.check_xmax_endstop)
self.UseYMaxPlug.stateChanged.connect(self.check_ymax_endstop)
self.UseZMaxPlug.stateChanged.connect(self.check_zmax_endstop)
if self.UseXMinPlug.isChecked() == False :
self.InvertXMinEndstop.setEnabled(False)
if self.UseYMinPlug.isChecked() == False :
self.InvertYMinEndstop.setEnabled(False)
if self.UseZMinPlug.isChecked() == False :
self.InvertZMinEndstop.setEnabled(False)
if self.UseXMaxPlug.isChecked() == False :
self.InvertXMaxEndstop.setEnabled(False)
if self.UseYMaxPlug.isChecked() == False :
self.InvertYMaxEndstop.setEnabled(False)
if self.UseZMaxPlug.isChecked() == False :
self.InvertZMaxEndstop.setEnabled(False)
#~~~~~~~~~~~~~~ Nozzle Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.SingleNozzle.toggled.connect(self.check_Nozzle)
self.SwichExruder.toggled.connect(self.check_Nozzle)
self.SwichNozzle.toggled.connect(self.check_Nozzle)
self.ParkExtruder.toggled.connect(self.check_Nozzle)
self.MixExtruder.toggled.connect(self.check_Nozzle)
self.MixingSteppers.setEnabled(False)
self.MixingSteppers.setText("")
self.NozzleHelpBtn.clicked.connect(self.OpenNozzleHelpUrl)
#~~~~~~~~~~~~~~ PSU Control Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.PSUControl.stateChanged.connect(self.check_psuState)
self.PowerTimeOut.setText("")
self.PowerOffTemp.setText("")
self.PSUHelpBtn.clicked.connect(self.OpenPSUHelpUrl)
#~~~~~~~~~~~~~~ Additional Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
self.EnableEeprom.stateChanged.connect(self.check_eepromState)
self.FilamentSensor.stateChanged.connect(self.check_FilamenState)
self.FiSenState.setEnabled(False)
self.AdvPause.stateChanged.connect(self.check_AdvPauseCheck)
self.ZAutoAlign.stateChanged.connect(self.check_auto_z_alien)
#QtWidgets.QComboBox.setCurrentText
self.LA_KFactor.setEnabled(False)
self.LAAvailable.stateChanged.connect(self.check_linearAdvance)
self.TXBufferSize.setCurrentText(tx_buffer_size)
if use_emergency_parcer == "on" :
self.EmeParser.setChecked(True)
if use_advanced_ok == "on" :
self.AdvancedOK.setChecked(True)
if advanced_pause_feature == "on" :
self.AdvPause.setChecked(True)
if monitor_driver_status == "on" :
self.MoDriverStatus.setChecked(True)
if sensorless_homing == "on" :
self.SenLessHome.setChecked(True)
if use_tmc_debugging == "on" :
self.TMCDebug.setChecked(True)
self.ChoVoltage.setCurrentText(chopper_voltage)
#~~~~~~~~~~~ Baby Stepping Options ~~~~~~~~~~~~~
self.IntiBabyStepping.setEnabled(False)
self.BabyStepWOHome.setEnabled(False)
self.BabyStepAlwAvail.setEnabled(False)
self.BabyStepXY.setEnabled(False)
self.BabyStepping.stateChanged.connect(self.check_babystepping)
self.BaStepHelpBtn.clicked.connect(self.OpenBaStepHelpUrl)
#~~~~~~~~~~~ Diable Dual-X Options by Defaultc~~~~~~~~~~~~~
self.X2MinPosition.setEnabled(False)
self.X2MaxPosition.setEnabled(False)
self.DupliOffset.setEnabled(False)
self.DualXEnable.stateChanged.connect(self.check_dualXstate)
self.DualXHelpBtn.clicked.connect(self.OpenDualXHelpUrl)
#~~~~~~~~~~~ Diable Input Shappingby Default ~~~~~~~~~~~~~
self.XInShapeFreq.setEnabled(False)
self.XInShapeZeta.setEnabled(False)
self.YInShapeFreq.setEnabled(False)
self.YInShapeZeta.setEnabled(False)
self.InputShappingX.stateChanged.connect(self.check_inputShapeX)
self.InputShappingY.stateChanged.connect(self.check_inputShapeY)
#~~~~~~~~~~~ Disable Current and Microsteps by Default ~~~~~~~~~~~~~
self.X2Current.setEnabled(False)
self.X2Microsteps.setEnabled(False)
self.X2Rence.setEnabled(False)
self.Y2Current.setEnabled(False)
self.Y2Microsteps.setEnabled(False)
self.Y2Rence.setEnabled(False)
self.Z2Current.setEnabled(False)
self.Z2Microsteps.setEnabled(False)
self.Z2Rence.setEnabled(False)
self.Z3Current.setEnabled(False)
self.Z3Microsteps.setEnabled(False)
self.Z3Rence.setEnabled(False)
self.Z4Current.setEnabled(False)
self.Z4Microsteps.setEnabled(False)
self.Z4Rence.setEnabled(False)
self.E1Current.setEnabled(False)
self.E1Microsteps.setEnabled(False)
self.E1Rence.setEnabled(False)
self.E2Current.setEnabled(False)
self.E2Microsteps.setEnabled(False)
self.E2Rence.setEnabled(False)
self.E3Current.setEnabled(False)
self.E3Microsteps.setEnabled(False)
self.E3Rence.setEnabled(False)
self.E4Current.setEnabled(False)
self.E4Microsteps.setEnabled(False)
self.E4Rence.setEnabled(False)
self.E5Current.setEnabled(False)
self.E5Microsteps.setEnabled(False)
self.E5Rence.setEnabled(False)
self.E6Current.setEnabled(False)
self.E6Microsteps.setEnabled(False)
self.E6Rence.setEnabled(False)
self.E7Current.setEnabled(False)
self.E7Microsteps.setEnabled(False)
self.E7Rence.setEnabled(False)
self.CalculateBtn.clicked.connect(self.CalcCurrent)
#Add all Displays to combobox
#self.AllDisplays = read_displays()
#for AllDisplays in self.AllDisplays:
# self.Display.addItem(AllDisplays)
# Restoring Display and Priner type
self.PrinterType.setCurrentText(printer_type)
#self.Display.setCurrentText(display_type)
# Show Driver_types from Config.ini file
#self.X_Driver.setCurrentText(x_driver_type)
if int(self.XMotorsNo.currentText()) == 1 :
self.X2_Driver.setEnabled(False)
if int(self.XMotorsNo.currentText()) == 2 :
self.X2_Driver.setCurrentText(x2_driver_type)
self.Y_Driver.setCurrentText(y_driver_type)
if int(self.YMotorsNo.currentText()) == 1 :
self.Y2_Driver.setEnabled(False)
if int(self.YMotorsNo.currentText()) == 2 :
self.Y2_Driver.setEnabled(True)
self.Y2_Driver.setCurrentText(y2_driver_type)
self.Z_Driver.setCurrentText(z_driver_type)
if int(self.ZMotorsNo.currentText()) == 1 :
self.Z2_Driver.setEnabled(False)
self.Z3_Driver.setEnabled(False)
self.Z4_Driver.setEnabled(False)
if int(self.ZMotorsNo.currentText()) == 2 :
self.Z2_Driver.setEnabled(True)
self.Z3_Driver.setEnabled(False)
self.Z4_Driver.setEnabled(False)
self.Z2_Driver.setCurrentText(z2_driver_type)
if int(self.ZMotorsNo.currentText()) == 3 :
self.Z2_Driver.setEnabled(True)
self.Z3_Driver.setEnabled(True)
self.Z4_Driver.setEnabled(False)
self.Z2_Driver.setCurrentText(z2_driver_type)
self.Z3_Driver.setCurrentText(z3_driver_type)
if int(self.ZMotorsNo.currentText()) == 4 :
self.Z2_Driver.setEnabled(True)
self.Z3_Driver.setEnabled(True)
self.Z4_Driver.setEnabled(True)
self.Z2_Driver.setCurrentText(z2_driver_type)
self.Z3_Driver.setCurrentText(z3_driver_type)
self.Z4_Driver.setCurrentText(z4_driver_type)
if int(self.Extruders.currentText()) == 1 :
self.E1_Driver.setEnabled(False)
self.E2_Driver.setEnabled(False)
self.E3_Driver.setEnabled(False)
self.E4_Driver.setEnabled(False)
self.E5_Driver.setEnabled(False)
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
if int(self.Extruders.currentText()) == 2 :
self.E2_Driver.setEnabled(False)
self.E3_Driver.setEnabled(False)
self.E4_Driver.setEnabled(False)
self.E5_Driver.setEnabled(False)
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
if int(self.Extruders.currentText()) == 3 :
self.E3_Driver.setEnabled(False)
self.E4_Driver.setEnabled(False)
self.E5_Driver.setEnabled(False)
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
if int(self.Extruders.currentText()) == 4 :
self.E4_Driver.setEnabled(False)
self.E5_Driver.setEnabled(False)
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
self.E3_Driver.setCurrentText(e3_driver_type)
print("e4")
if int(self.Extruders.currentText()) == 5 :
self.E5_Driver.setEnabled(False)
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
self.E3_Driver.setCurrentText(e3_driver_type)
self.E4_Driver.setCurrentText(e4_driver_type)
if int(self.Extruders.currentText()) == 6 :
self.E6_Driver.setEnabled(False)
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
self.E3_Driver.setCurrentText(e3_driver_type)
self.E4_Driver.setCurrentText(e4_driver_type)
self.E5_Driver.setCurrentText(e5_driver_type)
if int(self.Extruders.currentText()) == 7 :
self.E7_Driver.setEnabled(False)
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
self.E3_Driver.setCurrentText(e3_driver_type)
self.E4_Driver.setCurrentText(e4_driver_type)
self.E5_Driver.setCurrentText(e5_driver_type)
self.E6_Driver.setCurrentText(e6_driver_type)
if int(self.Extruders.currentText()) == 8 :
self.E0_Driver.setCurrentText(e0_driver_type)
self.E1_Driver.setCurrentText(e1_driver_type)
self.E2_Driver.setCurrentText(e2_driver_type)
self.E3_Driver.setCurrentText(e3_driver_type)
self.E4_Driver.setCurrentText(e4_driver_type)
self.E5_Driver.setCurrentText(e5_driver_type)
self.E6_Driver.setCurrentText(e6_driver_type)
self.E7_Driver.setCurrentText(e7_driver_type)
# Restore Temparature Sensors from ini file
self.TempSensor0.setCurrentText(temp_sensor_0)
self.TempSensor1.setCurrentText(temp_sensor_1)
self.TempSensor2.setCurrentText(temp_sensor_2)
self.TempSensor3.setCurrentText(temp_sensor_3)
self.TempSensor4.setCurrentText(temp_sensor_4)
self.TempSensor5.setCurrentText(temp_sensor_5)
self.TempSensor6.setCurrentText(temp_sensor_6)
self.TempSensorBed.setCurrentText(temp_sensor_bed)
self.HotendOvershoot.setText(hotend_overshoot)
self.BedOvershoot.setText(bed_overshoot)
self.CoolerOvershoot.setText(cooler_overshoot)
# Endstops Usage Status ~~~~~~~~~~~~~~~~~~
if use_xmin_plug == "on" :
self.UseXMinPlug.setChecked(True)
if use_ymin_plug == "on" :
self.UseYMinPlug.setChecked(True)
if use_zmin_plug == "on" :
self.UseZMinPlug.setChecked(True)
if use_xmax_plug == "on" :
self.UseXMaxPlug.setChecked(True)
if use_ymax_plug == "on" :
self.UseYMaxPlug.setChecked(True)
if use_zmax_plug == "on" :
self.UseZMaxPlug.setChecked(True)
# Endstops Invering Status ~~~~~~~~~~~~~~~~
if xmin_endstop_invert == "true" :
self.InvertXMinEndstop.setChecked(False)
if ymin_endstop_invert == "true" :
self.InvertYMinEndstop.setChecked(True)
if zmin_endstop_invert == "true" :
self.InvertZMinEndstop.setChecked(True)
if xmax_endstop_invert == "true" :
self.InvertXMaxEndstop.setChecked(True)
if ymax_endstop_invert == "true" :
self.InvertYMaxEndstop.setChecked(True)
if zmax_endstop_invert == "true" :
self.InvertZMaxEndstop.setChecked(True)
if zprobe_invert == "true" :
self.InvertProbeEndstop.setChecked(True)
# Restoring Steps per Unit from ini file ~~~~~~~~~~~~~~~~
self.XSteps.setText(xsteps_per_unit)
self.YSteps.setText(ysteps_per_unit)
self.ZSteps.setText(zsteps_per_unit)
self.E0Steps.setText(e0steps_per_unit)
# Restoring Max Feedrate from ini file ~~~~~~~~~~~~~~~~
self.XMaxFeedRate.setText(x_max_feedrate)
self.YMaxFeedRate.setText(y_max_feedrate)
self.ZMaxFeedRate.setText(z_max_feedrate)
self.E0MaxFeedRate.setText(e0_max_feedrate)
# Restoring Max Accleraion from ini file ~~~~~~~~~~~~~~~~
self.XMaxAccleration.setText(x_max_acceleration)
self.YMaxAccleration.setText(y_max_acceleration)
self.ZMaxAccleration.setText(z_max_acceleration)
self.E0MaxAccleration.setText(e0_max_acceleration)
# Restoring Axis Inverting from ini file ~~~~~~~~~~~~~~~~
self.InvertXAxis.setCurrentText(invert_x_dir)
self.InvertYAxis.setCurrentText(invert_y_dir)
self.InvertZAxis.setCurrentText(invert_z_dir)
self.InvertE0Axis.setCurrentText(invert_e0_dir)
# Restoring Axis Homing position from ini file ~~~~~~~~~~~~~~~~
self.XHoming.setCurrentText(x_homing_position)
self.YHoming.setCurrentText(y_homing_position)
self.ZHoming.setCurrentText(z_homing_position)
# Restoring Bed size from ini file ~~~~~~~~~~~~~~~~
self.XBedSize.setText(x_bed_size)
self.YBedSize.setText(y_bed_size)
self.ZHeight.setText(z_height)
self.XMinPosittion.setText(x_min_position)
self.YMinPosittion.setText(y_min_position)
# Restoring Z-Probe options from ini file ~~~~~~~~~~~~~~~~
if z_min_uses_zendstop_pin == "on" :
self.ZProbeUsesZMin.setChecked(True)
if use_probe_for_z_homing == "on" :
self.UseProbeZHome.setChecked(True)
if use_fixed_mounted_probe == "on" :
self.FixedProbe.setChecked(True)
if use_nozzle_as_probe == "on" :
self.NozzleasProbe.setChecked(True)
if use_bltouch == "on" :
self.BLTtouch.setChecked(True)
if use_sensorless_probing == "on" :
self.SenLessProbing.setChecked(True)
#probing_margin = 10
if use_multiple_probing == "on" :
self.MultipleProbing.setChecked(True)
if use_extra_probing == "on" :
self.ExtraProbing.setChecked(True)
self.ProbeXOffset.setText(probe_x_offset)
self.ProbeYOffset.setText(probe_y_offset)
self.ProbeZOffset.setText(probe_z_offset)
if use_probing_heaters_off == "on" :
self.ProbeHeatOff.setChecked(True)
if use_preheat_before_home == "on" :
self.PreHeatHoming.setChecked(True)
if use_z_safe_homing == "on" :
self.ZSafeHome.setChecked(True)
# Restoring Levelling options from ini file ~~~~~~~~~~~~~~~~
if leveling_3point == "on" :
self.Level3Point.setChecked(True)
if leveling_linear == "on" :
self.Linear.setChecked(True)
if leveling_bilinear == "on" :
self.BiLinear.setChecked(True)
if leveling_ubl == "on" :
self.UBL.setChecked(True)
if leveling_mesh == "on" :
self.MeshBed.setChecked(True)
self.LinearPoints.setText(linear_points)
self.UBLLevelPoints.setText(ubl_points)
self.MeshLevelPoints.setText(mesh_points)
if restore_after_g28 == "on" :
self.RestoreAfterG28.setChecked(True)
if preheat_before_level == "on" :
self.PreHeatLevel.setChecked(True)
if g26_mesh_validation == "on" :
self.G26MeshValid.setChecked(True)
if lcd_bed_levelling == "on" :
self.LcdBedLevel.setChecked(True)
# Restoring Nozzle options from ini file ~~~~~~~~~~~~~~~~~~
if use_single_nozzle == "on" :
self.SingleNozzle.setChecked(True)
if use_switching_extruder == "on" :
self.SwichExruder.setChecked(True)
if use_switching_nozzle == "on" :
self.SwichNozzle.setChecked(True)
if use_parking_extruder == "on" :
self.ParkExtruder.setChecked(True)
if use_mixing_extruder == "on" :
self.MixExtruder.setChecked(True)
self.MixingSteppers.setText(mixing_extruder_no)
if nozzle_park_feature == "on" :
self.NozParkFeature.setChecked(True)
if nozzle_clean_feature == "on" :
self.NozCleanFeature.setChecked(True)
# Restoring PSU-Conrol options from ini file ~~~~~~~~~~~~~~~~~~
if use_psu_conrol == "on" :
self.PSUControl.setChecked(True)
if psu_state == "low" :
self.PSUState.setCurrentText("LOW")
if psu_state == "high" :
self.PSUState.setCurrentText("HIGH")
if wait_for_cooldown == "on" :
self.WaitForCool.setChecked(True)
if auto_power_control == "on" :
self.AuPowControl.setChecked(True)
self.PowerTimeOut.setText(power_timeout)
self.PowerOffTemp.setText(poweroff_temparature)
# Restoring Additional options from ini file ~~~~~~~~~~~~~~~~~~
if enable_eeprom == "on" :
self.EnableEeprom.setChecked(True)
if reset_on_errors == "on" :
self.EepromReset.setChecked(True)
if clear_old_values == "on" :
self.EepromClear.setChecked(True)
if use_print_counter == "on" :
self.PrintCounter.setChecked(True)
if use_sd_support == "on" :
self.SDSupport.setChecked(True)
if individial_home_menu == "on" :
self.InAxisHoMenu.setChecked(True)
if use_speaker == "on" :
self.Speaker.setChecked(True)
if use_filament_sensor == "on" :
self.FilamentSensor.setChecked(True)
if filament_sensor_state == "low" :
self.FiSenState.setCurrentText("LOW")
if filament_sensor_state == "high" :
self.FiSenState.setCurrentText("HIGH")
# Seting Values Configuration_adv.h from ini
if extruder_runout_prevent == "on" :
self.ExRunoutPrevent.setChecked(True)
if use_controller_fan == "on" :
self.UseConrollerFan.setChecked(True)
if fast_pwm_fan == "on" :
self.FastPWMFan.setChecked(True)
self.ExAutoFanTemp.setText(extruder_auto_fan_temp)
if use_bltouch_high_speed == "on" :
self.BLTouchHighSpeed.setChecked(True)
if use_z_steppers_auto_align == "on" :
self.ZAutoAlign.setChecked(True)
if use_adaptive_step_smoothing == "on" :
self.AdStepSmooth.setChecked(True)
if use_powerloss_recovery == "on" :
self.PowLossRecover.setChecked(True)
if use_linear_advance == "on" :
self.LAAvailable.setChecked(True)
self.LA_KFactor.setText(linear_advance_kfactor)
if use_g29_retry_recover == "on" :
self.G29RetryRecover.setChecked(True)
if long_filename_support == "on" :
self.LongFileName.setChecked(True)
if scroll_long_filename == "on" :
self.ScrolLongFile.setChecked(True)
# Baby Stepping
if enable_baby_stepping == "on" :
self.BabyStepping.setChecked(True)
if inegrated_baby_stepping == "on" :
self.IntiBabyStepping.setChecked(True)
if baby_step_without_homing == "on" :
self.BabyStepWOHome.setChecked(True)
if baby_step_always_available == "on" :
self.BabyStepAlwAvail.setChecked(True)
if baby_step_on_xy == "on" :
self.BabyStepXY.setChecked(True)
# Dual-X Carriage
if enable_dual_x_carriage == "on" :
self.DualXEnable.setChecked(True)
self.X2MinPosition.setText(dualx_x2_min_position)
self.X2MaxPosition.setText(dualx_x2_max_position)
self.DupliOffset.setText(dualx_duplication_offset)
else :
self.DualXEnable.setChecked(False)
# Input Shapping
if enable_x_input_shapping == "on" :
self.InputShappingX.setChecked(True)
self.XInShapeFreq.setText(x_input_shapping_frequency)
self.XInShapeZeta.setText(x_input_shapping_zeta)
if enable_y_input_shapping == "on" :
self.InputShappingY.setChecked(True)
self.YInShapeFreq.setText(y_input_shapping_frequency)
self.YInShapeZeta.setText(y_input_shapping_zeta)
# Steppers Curren & Microsteps
self.XCurrent.setText(x_current)
self.XMicrosteps.setCurrentText(x_micro_steps)
self.XRence.setText(x_rense)
self.X2Current.setText(x2_current)
self.X2Microsteps.setCurrentText(x2_micro_steps)
self.X2Rence.setText(x2_rense)
self.YCurrent.setText(y_current)
self.YMicrosteps.setCurrentText(y_micro_steps)
self.YRence.setText(y_rense)
self.Y2Current.setText(y2_current)
self.Y2Microsteps.setCurrentText(y2_micro_steps)
self.Y2Rence.setText(y2_rense)
self.ZCurrent.setText(z_current)
self.ZMicrosteps.setCurrentText(z_micro_steps)
self.ZRence.setText(z_rense)
self.Z2Current.setText(z2_current)
self.Z2Microsteps.setCurrentText(z2_micro_steps)
self.Z2Rence.setText(z2_rense)
self.Z3Current.setText(z3_current)
self.Z3Microsteps.setCurrentText(z3_micro_steps)
self.Z3Rence.setText(z3_rense)
self.Z4Current.setText(z4_current)
self.Z4Microsteps.setCurrentText(z4_micro_steps)
self.Z4Rence.setText(z4_rense)
self.E0Current.setText(e0_current)
self.E0Microsteps.setCurrentText(e0_micro_steps)
self.E0Rence.setText(e0_rense)
self.E1Current.setText(e1_current)
self.E1Microsteps.setCurrentText(e1_micro_steps)
self.E1Rence.setText(e1_rense)
self.E2Current.setText(e2_current)
self.E2Microsteps.setCurrentText(e2_micro_steps)
self.E2Rence.setText(e2_rense)
self.E3Current.setText(e3_current)
self.E3Microsteps.setCurrentText(e3_micro_steps)
self.E3Rence.setText(e3_rense)
self.E4Current.setText(e4_current)
self.E4Microsteps.setCurrentText(e4_micro_steps)
self.E4Rence.setText(e4_rense)
self.E5Current.setText(e5_current)
self.E5Microsteps.setCurrentText(e5_micro_steps)
self.E5Rence.setText(e5_rense)
self.E6Current.setText(e6_current)
self.E6Microsteps.setCurrentText(e6_micro_steps)
self.E6Rence.setText(e6_rense)
self.E7Current.setText(e7_current)
self.E7Microsteps.setCurrentText(e7_micro_steps)
self.E7Rence.setText(e7_rense)
#parser = configparser.ConfigParser()
#parser.set('Configuration.h', 'extruders','5')
#with open('Config.ini', 'wb') as Newconfigfile:
# parser.write(Newconfigfile)
self.GenerateBtn.clicked.connect(self.GenarateFn)
def OpenZHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#z-probe-options')
def OpenLevelHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#bed-leveling')
def OpenNozzleHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#single-nozzle')
def OpenPSUHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#power-supply')
def OpenDualXHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#dual-x-carriage')
def OpenBaStepHelpUrl(self) :
webbrowser.open('https://marlinfw.org/docs/configuration/configuration.html#babystepping')
def GenarateFn(self):
TargetDir = self.PrinterName.text() #Read current text in Printer Name
try:
os.mkdir(TargetDir) #Create Folder with name same as Printer Name
except OSError:
print ("Direcory Already Exists")
else:
print ("Successfully Created the directory %s " % TargetDir)
#~~~~~~~~~~~~~~~~~~~~~~ Start Changing Environmen in platformio.ino File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Newdata = (''.join(self.Environment.currentText())) #Get Current text in Envoronment Combobox'
NewEnvironment = (''.join(Newdata.splitlines())) #To Delete next line '\n'
config.set('platformio', 'default_envs', NewEnvironment)
NewEnvironment = "default_envs = "+ NewEnvironment
f1 = open(SourceDir+'platformio.ini', 'r')
f2 = open(TargetDir+'\platformio.ini', 'w')
for line in f1:
f2.write(line.replace("default_envs = mega2560", NewEnvironment))
f1.close()
f2.close()
#~~~~~~~~~~~~~~~~~~~~~~ End Changing Environmen in platformio.ino File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~ Start Changing in Configuration.h File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
f1Read = open(SourceDir+'Configuration.h', 'r')
f2Write = open(TargetDir+'\Configuration.h', 'w')
ConfigFile = TargetDir+'\Configuration.h'
for line in f1Read:
f2Write.write(line.replace("none, default config", self.AuthorTxt.text())) # Changing Author Name
f1Read.close()
f2Write.close()
with fileinput.FileInput(ConfigFile, inplace=True) as file:
NewBoard= (''.join(self.BoardTxt.currentText())) #Get Current text in BoardTxt Combobox'
NewBoard = (''.join(NewBoard.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'motherboard', NewBoard)
NewBoard = "#define MOTHERBOARD " + "BOARD_"+NewBoard
for line in file:
print(line.replace("#define MOTHERBOARD ", NewBoard + Modified), end='') # Changing MotherBoard
NewSerial0 = (''.join(self.Serial0.currentText())) #Get Current text in Serial 0 Combobox'
NewSerial0 = (''.join(NewSerial0.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'serial_port', NewSerial0)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define SERIAL_PORT ", "#define SERIAL_PORT "+ NewSerial0 + Modified), end='') # Changing Serial 0
NewSerial2 = (''.join(self.Serial2.currentText())) #Get Current text in Serial2 Combobox'
NewSerial2 = (''.join(NewSerial2.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'serial_port_2', NewSerial2)
if NewSerial2 != "None" :
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define SERIAL_PORT_2 ", "#define SERIAL_PORT_2 "+ NewSerial2 + Modified), end='') # Changing Serial 2
NewSerial3 = (''.join(self.Serial3.currentText())) #Get Current text in Serial3 Combobox'
NewSerial3 = (''.join(NewSerial3.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'serial_port_3', NewSerial3)
if NewSerial3 != "None" :
print(NewSerial3)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define SERIAL_PORT_3 ", "#define SERIAL_PORT_3 "+ NewSerial3 + Modified), end='') # Changing Serial 3
NewBaudRate = (''.join(self.BaudRate.currentText())) #Get Current text in BaudRate Combobox'
NewBaudRate = (''.join(NewBaudRate.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'baudrate', NewBaudRate)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define BAUDRATE ", "#define BAUDRATE "+ NewBaudRate + Modified), end='') # Changing BaudRate
NewXDriver= (''.join(self.X_Driver.currentText())) #Get Current text in X_Driver Combobox'
NewXDriver = (''.join(NewXDriver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'x_driver_type', NewXDriver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define X_DRIVER_TYPE", "#define X_DRIVER_TYPE "+ NewXDriver + Modified), end='') # Changing X Driver
if self.X2_Driver.isEnabled()== True :
NewX2Driver= (''.join(self.X2_Driver.currentText())) #Get Current text in X2_Driver Combobox'
NewX2Driver = (''.join(NewX2Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'x2_driver_type', NewX2Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define X2_DRIVER_TYPE", "#define X2_DRIVER_TYPE "+ NewX2Driver + Modified), end='') # Changing X2 Driver
else : config.set('Configuration.h', 'x2_driver_type', "")
NewYDriver= (''.join(self.Y_Driver.currentText())) #Get Current text in Y_Driver Combobox'
NewYDriver = (''.join(NewYDriver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'y_driver_type', NewYDriver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define Y_DRIVER_TYPE", "#define Y_DRIVER_TYPE "+ NewYDriver + Modified), end='') # Changing Y Driver
if self.Y2_Driver.isEnabled() == True :
NewY2Driver= (''.join(self.Y2_Driver.currentText())) #Get Current text in Y2_Driver Combobox'
NewY2Driver = (''.join(NewY2Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'y2_driver_type', NewY2Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define Y2_DRIVER_TYPE", "#define Y2_DRIVER_TYPE "+ NewY2Driver + Modified), end='') # Changing Y2 Driver
else : config.set('Configuration.h', 'y2_driver_type', "")
NewZDriver= (''.join(self.Z_Driver.currentText())) #Get Current text in Z_Driver Combobox'
NewZDriver = (''.join(NewZDriver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'z_driver_type', NewZDriver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define Z_DRIVER_TYPE", "#define Z_DRIVER_TYPE "+ NewZDriver + Modified), end='') # Changing Z Driver
if self.Z2_Driver.isEnabled() == True :
NewZ2Driver= (''.join(self.Z2_Driver.currentText())) #Get Current text in Z2_Driver Combobox'
NewZ2Driver = (''.join(NewZ2Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'z2_driver_type', NewZ2Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define Z2_DRIVER_TYPE", "#define Z2_DRIVER_TYPE "+ NewZ2Driver + Modified), end='') # Changing Z2 Driver
else : config.set('Configuration.h', 'z2_driver_type', "")
if self.Z3_Driver.isEnabled() == True :
NewZ3Driver= (''.join(self.Z3_Driver.currentText())) #Get Current text in Z3_Driver Combobox'
NewZ3Driver = (''.join(NewZ3Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'z3_driver_type', NewZ3Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define Z3_DRIVER_TYPE", "#define Z3_DRIVER_TYPE "+ NewZ3Driver + Modified), end='') # Changing Z3 Driver
else : config.set('Configuration.h', 'z3_driver_type', "")
if self.Z4_Driver.isEnabled() == True :
NewZ4Driver= (''.join(self.Z4_Driver.currentText())) #Get Current text in Z4_Driver Combobox'
NewZ4Driver = (''.join(NewZ4Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'z4_driver_type', NewZ4Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define Z4_DRIVER_TYPE", "#define Z4_DRIVER_TYPE "+ NewZ4Driver + Modified), end='') # Changing Z4 Driver
else : config.set('Configuration.h', 'z4_driver_type', "")
NewE0Driver= (''.join(self.E0_Driver.currentText())) #Get Current text in E0_Driver Combobox'
NewE0Driver = (''.join(NewE0Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e0_driver_type', NewE0Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define E0_DRIVER_TYPE", "#define E0_DRIVER_TYPE "+ NewE0Driver + Modified), end='') # Changing E0 Driver
if self.E1_Driver.isEnabled() == True :
NewE1Driver= (''.join(self.E1_Driver.currentText())) #Get Current text in E1_Driver Combobox'
NewE1Driver = (''.join(NewE1Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e1_driver_type', NewE1Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E1_DRIVER_TYPE", "#define E1_DRIVER_TYPE "+ NewE1Driver + Modified), end='') # Changing E1 Driver
else : config.set('Configuration.h', 'e1_driver_type', "")
if self.E2_Driver.isEnabled() == True :
NewE2Driver= (''.join(self.E2_Driver.currentText())) #Get Current text in E2_Driver Combobox'
NewE2Driver = (''.join(NewE2Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e2_driver_type', NewE2Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E2_DRIVER_TYPE", "#define E2_DRIVER_TYPE "+ NewE2Driver + Modified), end='') # Changing E2 Driver
else : config.set('Configuration.h', 'e2_driver_type', "")
if self.E3_Driver.isEnabled() == True :
NewE3Driver= (''.join(self.E3_Driver.currentText())) #Get Current text in E3_Driver Combobox'
NewE3Driver = (''.join(NewE3Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e3_driver_type', NewE3Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E3_DRIVER_TYPE", "#define E3_DRIVER_TYPE "+ NewE3Driver + Modified), end='') # Changing E3 Driver
else : config.set('Configuration.h', 'e3_driver_type', "")
if self.E4_Driver.isEnabled() == True :
NewE4Driver= (''.join(self.E4_Driver.currentText())) #Get Current text in E4_Driver Combobox'
NewE4Driver = (''.join(NewE4Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e4_driver_type', NewE4Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E4_DRIVER_TYPE", "#define E4_DRIVER_TYPE "+ NewE4Driver + Modified), end='') # Changing E4 Driver
else : config.set('Configuration.h', 'e4_driver_type', "")
if self.E5_Driver.isEnabled() == True :
NewE5Driver= (''.join(self.E5_Driver.currentText())) #Get Current text in E5_Driver Combobox'
NewE5Driver = (''.join(NewE5Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e5_driver_type', NewE5Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E5_DRIVER_TYPE", "#define E5_DRIVER_TYPE "+ NewE5Driver + Modified), end='') # Changing E5 Driver
else : config.set('Configuration.h', 'e5_driver_type', "")
if self.E6_Driver.isEnabled() == True :
NewE6Driver= (''.join(self.E6_Driver.currentText())) #Get Current text in E6_Driver Combobox'
NewE6Driver = (''.join(NewE6Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e6_driver_type', NewE6Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E6_DRIVER_TYPE", "#define E6_DRIVER_TYPE "+ NewE6Driver + Modified), end='') # Changing E6 Driver
else : config.set('Configuration.h', 'e6_driver_type', "")
if self.E7_Driver.isEnabled() == True :
NewE7Driver= (''.join(self.E7_Driver.currentText())) #Get Current text in E7_Driver Combobox'
NewE7Driver = (''.join(NewE7Driver.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'e7_driver_type', NewE7Driver)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define E7_DRIVER_TYPE", "#define E7_DRIVER_TYPE "+ NewE7Driver + Modified), end='') # Changing E7 Driver
else : config.set('Configuration.h', 'e7_driver_type', "")
NewExtruders= (''.join(self.Extruders.currentText())) #Get Current text in Extruders Combobox'
NewExtruders = (''.join(NewExtruders.splitlines())) #To Delete next line '\n'
config.set('Configuration.h', 'extruders', NewExtruders)
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("#define EXTRUDERS", "#define EXTRUDERS "+ NewExtruders + Modified), end='') # Changing Extruders Number
if self.SingleNozzle.isChecked() == True :
config.set('Configuration.h', 'use_single_nozzle', "on")
with fileinput.FileInput(ConfigFile, inplace=True) as file:
for line in file:
print(line.replace("//#define SINGLENOZZLE", "#define SINGLENOZZLE"+ Modified), end='') # Enabling Single Nozzle