forked from geosim/QAD
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathqad.py
More file actions
2225 lines (1838 loc) · 98.2 KB
/
qad.py
File metadata and controls
2225 lines (1838 loc) · 98.2 KB
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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
comandi di editazione geometria stile CAD
-------------------
begin : 2014-11-03
copyright : 2013-2016
email : hhhhh
developers : bbbbb aaaaa ggggg
***************************************************************************/
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
# Import the PyQt and QGIS libraries
from qgis.PyQt.QtCore import Qt, QObject, QTranslator, qVersion, QCoreApplication, QSettings
from qgis.PyQt.QtGui import QIcon, QKeySequence
from qgis.PyQt.QtWidgets import QAction, QMenu, QToolButton, QShortcut, QMessageBox, QWIDGETSIZE_MAX
from qgis.core import QgsPointXY, QgsProject, QgsMapLayer, QgsSettings, QgsApplication
from qgis.gui import QgsGui
# Initialize Qt resources from file qad_rc.py
from .qad_rc import *
import os
import math
from .qad_msg import QadMsg
from .qad_shortcuts import QadShortcuts
from .qad_utils import getAngleBy2Pts, normalizeAngle
from .qad_layer import getLayerById, QadLayerStatusEnum, QadLayerStatusListClass
from .qad_maptool import QadMapTool
from .qad_variables import QadVariables, QadAUTOSNAPEnum
from .qad_snapper import QadSnapTypeEnum
from .qad_textwindow import QadTextWindow, QadInputTypeEnum, QadInputModeEnum
from .qad_commands import QadCommandsClass, getMaxDailyCmdCounter
from .qad_entity import QadLayerEntitySet, QadEntity, QadEntitySet
from .qad_dim import QadDimStyles
from .qad_undoredo import QadUndoStack
from .cmd.qad_array_cmd import QadARRAYCommandClassSeriesTypeEnum
class Qad(QObject):
"""
Classe plug in di Qad
"""
# UI
toolBar = None
dimToolBar = None
menu = None
translator = None
# Map Tool attivo. Quando non ci sono comandi che necessitano di input dalla finestra grafica
# QadMapTool é quello attivo
tool = None
# Finestra grafica
canvas = None
# Finestra testuale
TextWindow = None
# Classe che gestisce i comandi
QadCommands = None
# Azione corrente
currentAction = None
# ultimo punto selezionato
lastPoint = None
# coeff angolare ultimo segmento
lastSegmentAng = 0.0
# ultima rotazione
lastRot = 0.0
# ultima altezza testo
lastHText = 1.0
# ultimo angolo di riferimento (es. comando ruota)
lastReferenceRot = 0.0
# ultimo nuovo angolo di riferimento (es. comando ruota)
lastNewReferenceRot = 0.0
# ultimo raggio
lastRadius = 1.0
# ultimo punto di offset
lastOffsetPt = QgsPointXY(0, 0)
# ultima lunghezza di riferimento (es. comando scala)
lastReferenceLen = 1.0
# ultima lunghezza di riferimento (es. comando scala)
lastNewReferenceLen = 1.0
# ultimo fattore di scala (es. comando scala)
lastScale = 1.0
# numero di segmenti per l'approssimazione delle curve (es. buffer)
segments = 10
# ultima entità inserita
lastEntity = None
# ultimo set di entità
lastEntitySet = None
# tipo di unione (es. editpl->unione)
joinMode = 1 # 1=Estendi, 2=Aggiungi, 3=Entrambi
# distanza di approssimazione nell'unione (es. editpl->unione)
joinToleranceDist = QadVariables.get(QadMsg.translate("Environment variables", "TOLERANCE2COINCIDENT"))
# modalità di raccordo in comando raccordo
filletMode = 1 # 1=Taglia-estendi, 2=Non taglia-estendi
# ultimo numero di lati per poligono
lastPolygonSideNumber = 4
# ultima opzione di costruzione del poligono conoscendo il centro
# "Inscritto nel cerchio", Circoscritto intorno al cerchio", "Area"
lastPolygonConstructionModeByCenter = QadMsg.translate("Command_POLYGON", "Inscribed in circle")
# ultimo delta usato nel comando lengthen
lastDelta_lengthen = 0.0
# ultimo delta angolo usato nel comando lengthen
lastDeltaAngle_lengthen = 0.0
# ultima percentuale usata nel comando lengthen
lastPerc_lengthen = 100.0
# ultima lunghezza totale usato nel comando lengthen
lastTotal_lengthen = 1.0
# ultimo angolo totale usato nel comando lengthen
lastTotalAngle_lengthen = 0.0
# ultima modalità operativa del comando lengthen
lastOpMode_lengthen = "DElta"
# INIZIO PARAMETRI COMANDO ARRRAY
# ultima tipo di serie del comando array
lastArrayType_array = QadARRAYCommandClassSeriesTypeEnum.RECTANGLE
# memorizzo se gli elementi vanno ruotati
lastItemsRotation_array = True
# ultimo l'angolo di orientamento della serie di tipo rettangolo
lastRectangleAngle_array = 0.0
# ultimo numero di colonne della serie di tipo rettangolo
lastRectangleCols_array = 4
# ultimo numero di righe della serie di tipo rettangolo
lastRectangleRows_array = 3
# ultima direzione della tangente per la serie di tipo traiettoria
lastPathTangentDirection_array = 0.0
# ultimo numero di righe della serie di tipo traiettoria
lastPathRows_array = 1
# ultimo numero di elementi della serie di tipo polare
lastPolarItemsNumber_array = 6
# ultimo angolo tra gli elementi della serie di tipo polare
lastPolarAngleBetween_array = math.pi / 3 # 60 gradi (60 * 6 = 360 gradi)
# ultimo numero di righe della serie di tipo polare
lastPolarRows_array = 1
# FINE PARAMETRI COMANDO ARRRAY
# flag per identificare se un comando di QAD é attivo oppure no
isQadActive = False
# Quotatura
dimTextEntitySetRecodeOnSave = QadLayerEntitySet() # entity set dei testi delle quote da riallineare in salvataggio
beforeCommitChangesDimLayer = None # layer da cui é scaturito il salvataggio delle quotature
layerStatusList = QadLayerStatusListClass()
# comando dsettings - ultimo tab utilizzato
dsettingsLastUsedTabIndex = -1 # -1 = non inizializzato
# comando options - ultimo tab utilizzato
optionsLastUsedTabIndex = -1 # -1 = non inizializzato
# comando dimstyle - ultimo tab utilizzato
dimStyleLastUsedTabIndex = -1 # -1 = non inizializzato
cmdsHistory = [] # lista della storia degli ultimi comandi usati
ptsHistory = [] # lista della storia degli ultimi punti usati
shortcuts = QadShortcuts()
maxDailyCmdCounter = -1
# ============================================================================
# version
# ============================================================================
def version(self):
return "3.0.8" # allinea con metadata.txt alla sez [general] voce "version"
def setLastPointAndSegmentAng(self, point, segmentAng = None):
# memorizzo il coeff angolare ultimo segmento e l'ultimo punto selezionato
if segmentAng is None:
if self.lastPoint is not None:
self.setLastSegmentAng(getAngleBy2Pts(self.lastPoint, point))
else:
self.setLastSegmentAng(segmentAng)
self.setLastPoint(point)
def setLastPoint(self, point):
if point is None: return
# memorizzo l'ultimo punto selezionato
self.lastPoint = QgsPointXY(point)
self.updatePtsHistory(self.lastPoint)
def setLastSegmentAng(self, segmentAng):
# memorizzo il coeff angolare ultimo segmento
self.lastSegmentAng = normalizeAngle(segmentAng)
def setLastRot(self, rot):
# memorizzo l'ultima rotazione in radianti
self.lastRot = normalizeAngle(rot)
def setLastHText(self, hText):
# memorizzo l'ultima altezza testo
if hText > 0:
self.lastHText = hText
def setLastReferenceRot(self, rot):
# memorizzo l'ultimo angolo di riferimento (es. comando ruota) in radianti
self.lastReferenceRot = normalizeAngle(rot)
def setLastNewReferenceRot(self, rot):
# memorizzo l'ultimo nuovo angolo di riferimento (es. comando ruota) in radianti
self.lastNewReferenceRot = normalizeAngle(rot)
def setLastRadius(self, radius):
# memorizzo l'ultimo raggio
if radius > 0:
self.lastRadius = radius
def setLastOffsetPt(self, offsetPt):
# memorizzo l'ultimo punto di offset
# la x del punto rappresenta l'offset X
# la y del punto rappresenta l'offset Y
self.lastOffsetPt.set(offsetPt.x(), offsetPt.y())
def setLastReferenceLen(self, length):
# memorizzo l'ultima lunghezza di riferimento (es. comando scale)
self.lastReferenceLen = length
def setLastNewReferenceRot(self, length):
# memorizzo l'ultima nuova lunghezza di riferimento (es. comando scale)
self.lastNewReferenceLen = length
def setLastScale(self, scale):
# memorizzo l'ultimo fattore di scala
if scale > 0:
self.lastScale = scale
def setNSegmentsToApproxCurve(self, segments):
# memorizzo il numero di segmenti per l'approssimazione delle curve (es. buffer)
if segments > 1:
self.segments = int(segments)
def setLastEntity(self, layer, featureId):
# memorizzo l'ultimo entità creata
if self.lastEntity is None:
self.lastEntity = QadEntity()
self.lastEntity.set(layer, featureId)
def getLastEntity(self):
if self.lastEntity is None:
return None
else:
if self.lastEntity.exists() == False: # non esiste più
return None
else:
return self.lastEntity
def setLastEntitySet(self, entitySet):
# memorizzo l'ultimo set di entità
if self.lastEntitySet is None:
self.lastEntitySet = QadEntitySet()
self.lastEntitySet.set(entitySet)
def setJoinMode(self, joinMode):
# memorizzo tipo di unione (es. editpl->unione); 1=Estendi, 2=Aggiungi, 3=Entrambi
if joinMode == 1 or joinMode == 2 or joinMode == 3:
self.joinMode = int(joinMode)
def setJoinToleranceDist(self, joinToleranceDist):
# memorizzo la distanza di approssimazione nell'unione (es. editpl->unione)
if joinToleranceDist >= 0:
self.joinToleranceDist = joinToleranceDist
def setFilletMode(self, filletMode):
# memorizzo modalità di raccordo in comando raccordo; 1=Taglia-estendi, 2=Non taglia-estendi
if filletMode == 1 or filletMode == 2:
self.filletMode = int(filletMode)
def setLastPolygonSideNumber(self, polygonSideNumber):
# memorizzo l'ultimo numero di lati del poligono
if polygonSideNumber > 2:
self.lastPolygonSideNumber = polygonSideNumber
def setLastPolygonConstructionModeByCenter(self, mode):
# memorizzo ultima opzione di costruzione del poligono conoscendo il centro
# "Inscritto nel cerchio", Circoscritto intorno al cerchio", "Area"
self.lastPolygonConstructionModeByCenter = mode
def setLastDelta_lengthen(self, lastDelta_lengthen):
# ultimo delta usato nel comando lengthen
self.lastDelta_lengthen = lastDelta_lengthen
def setLastDeltaAngle_lengthen(self, lastDeltaAngle_lengthen):
# ultimo delta angolo usato nel comando lengthen
self.lastDeltaAngle_lengthen = normalizeAngle(lastDeltaAngle_lengthen)
def setLastPerc_lengthen(self, lastPerc_lengthen):
# ultima percentuale usata nel comando lengthen
if lastPerc_lengthen > 0:
self.lastPerc_lengthen = lastPerc_lengthen
def setLastTotal_lengthen(self, lastTotal_lengthen):
# ultima lunghezza totale usato nel comando lengthen
if lastTotal_lengthen > 0:
self.lastTotal_lengthen = lastTotal_lengthen
def setLastTotalAngle_lengthen(self, lastTotalAngle_lengthen):
# ultimo angolo totale usato nel comando lengthen
self.lastTotalAngle_lengthen = normalizeAngle(lastTotalAngle_lengthen)
def setLastOpMode_lengthen(self, opMode):
# memorizzo modalità operativa del comando lengthen: "DElta" o "Percent" o "Total" o "DYnamic"
if opMode == "DElta" or opMode == "Percent" or opMode == "Total" or opMode == "DYnamic":
self.lastOpMode_lengthen = opMode
# INIZIO PARAMETRI COMANDO ARRRAY
def setLastArrayType_array(self, arrayType):
# memorizzo il tipo di serie del comando array
self.lastArrayType_array = arrayType
def setLastItemsRotation_array(self, itemsRotation):
# memorizzo se gli elementi vanno ruotati
self.lastItemsRotation_array = itemsRotation
def setLastRectangleAngle_array(self, rectangleAngle):
# memorizzo l'angolo di orientamento della serie di tipo rettangolo
self.lastRectangleAngle_array = rectangleAngle
def setLastRectangleCols_array(self, rectangleCols):
# memorizzo il numero di colonne della serie di tipo rettangolo
self.lastRectangleCols_array = rectangleCols
def setLastRectangleRows_array(self, rectangleRows):
# memorizzo il numero di righe della serie di tipo rettangolo
self.lastRectangleRows_array = rectangleRows
def setLastPathTangentDirection_array(self, pathTangentDirection):
# memorizzo la direzione della tangente per la serie di tipo traiettoria
self.lastPathTangentDirection_array = pathTangentDirection
def setLastPathRows_array(self, pathRows):
# memorizzo il numero di righe della serie di tipo traiettoria
self.lastPathRows_array = pathRows
def setLastPolarItemsNumber_array(self, polarItemsNumber):
# memorizzo il numero di elementi della serie di tipo polare
self.lastPolarItemsNumber_array = polarItemsNumber
def setLastPolarAngleBetween_array(self, polarAngleBetween):
# memorizzo l'angolo tra gli elementi della serie di tipo polare
self.lastPolarAngleBetween_array = polarAngleBetween
def setLastPolarRows_array(self, polarRows):
# memorizzo il numero di righe della serie di tipo polare
self.lastPolarRows_array = polarRows
# FINE PARAMETRI COMANDO ARRRAY
def loadDimStyles(self):
global QadDimStyles
# carico gli stili di quotatura
QadDimStyles.load()
# questa variabile non avrebbe senso perchè si dovrebbe usare la variabile globale QadDimStyles
# per un motivo sconosciuto quando si generano gli eventi tipo beforeCommitChanges
# la variabile globale QadDimStyles risulta essere None anche se QAD non lo hai mai posto a quel valore
# se invece uso una variabile del plugin che punta a QadDimStyles questa non viene messa a None
self.mQadDimStyle = QadDimStyles
# ============================================================================
# __initLocalization
# ============================================================================
# inizializza la localizzazione delle traduzioni e dell'help in linea
def __initLocalization(self, locale):
# traduzioni proprie di qt
# ad esempio l'italiano fornito con qgis non va bene quindi se lo trovo nella cartella del plugin lo carico
localePath = os.path.join(self.plugin_dir, 'i18n', 'qt_{}.qm'.format(locale))
if os.path.exists(localePath):
self.qttranslator = QTranslator()
self.qttranslator.load(localePath)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.qttranslator)
localePath = os.path.join(self.plugin_dir, 'i18n', 'qad_{}.qm'.format(locale))
if os.path.exists(localePath):
self.translator = QTranslator()
self.translator.load(localePath)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
return True
else:
return False
# ============================================================================
# __init__
# ============================================================================
def __init__(self, iface):
QObject.__init__(self)
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
userLocaleList = QSettings().value("locale/userLocale").split("_")
language = userLocaleList[0]
region = userLocaleList[1] if len(userLocaleList) > 1 else ""
# provo a caricare la lingua e la regione selezionate
if self.__initLocalization(language + "_" + region) == False:
# provo a caricare la lingua
self.__initLocalization(language)
self.canvas = self.iface.mapCanvas()
# Lista dei comandi va creata dopo aver inizializzato self.canvas
self.QadCommands = QadCommandsClass(self)
self.TextWindow = None
# inizializzazione sul caricamento del progetto
self.initOnProjectLoaded()
# QadMapTool va creato dopo aver inizializzato self.QadCommands e self.canvas e self.initOnProjectLoaded()
self.tool = QadMapTool(self)
self.maxDailyCmdCounter = getMaxDailyCmdCounter()
# ============================================================================
# INIZIO - gestione shortcut perchè certi tasti premuti nel mapcanvas non arrivano ...
# ============================================================================
def enableShortcut(self):
self.shortcuts.registerForPrintableAndQadFKeys()
return
def disableShortcut(self):
self.shortcuts.unregisterForPrintableAndQadFKeys()
return
def getCurrentMapTool(self):
if self.canvas.mapTool() == self.tool:
return self.tool
elif self.QadCommands.actualCommand is not None:
if self.canvas.mapTool() == self.QadCommands.actualCommand.getPointMapTool():
return self.QadCommands.actualCommand.getPointMapTool()
return None
def sendKeyToCurrentMapTool(self, keyEvent):
mt = self.getCurrentMapTool()
if mt is not None:
mt.keyPressEvent(keyEvent)
def send_a_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, "a"))
def send_A_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, "A"))
def send_c_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_C, Qt.NoModifier, "c"))
def send_C_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_C, Qt.NoModifier, "C"))
def send_d_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_D, Qt.NoModifier, "d"))
def send_D_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_D, Qt.NoModifier, "D"))
def send_p_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_P, Qt.NoModifier, "p"))
def send_P_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_P, Qt.NoModifier, "P"))
def send_x_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_X, Qt.NoModifier, "x"))
def send_X_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_X, Qt.NoModifier, "X"))
def send_y_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_Y, Qt.NoModifier, "y"))
def send_Y_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_Y, Qt.NoModifier, "Y"))
def send_F3_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_F3, Qt.NoModifier))
def send_Backspace_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_Backspace, Qt.NoModifier))
def send_Delete_toTxtWindow(self):
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier))
# ============================================================================
# FINE - gestione shortcut perchè certi tasti premuti nel mapcanvas non arrivano ...
# ============================================================================
def initOnProjectLoaded(self):
# carico le variabili d'ambiente
QadVariables.load()
if self.TextWindow is not None:
self.TextWindow.refreshColors()
# carico gli stili di quotatura
self.loadDimStyles()
# Gestore di Undo/Redo
self.undoStack = QadUndoStack()
self.UpdatedVariablesEvent()
def initGui(self):
# creo tutte le azioni e le collego ai comandi
self.initActions()
# Connect to signals
self.canvas.mapToolSet.connect(self.deactivate)
# Add menu
self.menu = QMenu(QadMsg.getQADTitle()) # titolo (nome applicazione + sponsor)
self.menu.addAction(self.mainAction)
# crea il menu help
self.helpMenu = self.createHelpMenu()
self.menu.addMenu(self.helpMenu)
self.menu.addAction(self.u_action)
self.menu.addAction(self.undo_action)
self.menu.addAction(self.redo_action)
# crea il menu Draw
self.drawMenu = self.createDrawMenu()
self.menu.addMenu(self.drawMenu)
# menu Edit
self.editMenu = self.createEditMenu()
self.menu.addMenu(self.editMenu)
# menu Tools
self.toolsMenu = self.createToolsMenu()
self.menu.addMenu(self.toolsMenu)
# menu Dim
self.dimMenu = self.createDimMenu()
self.menu.addMenu(self.dimMenu)
# aggiunge il menu al menu vector di QGIS
self.iface.vectorMenu().addMenu(self.menu)
# menu_bar = self.iface.mainWindow().menuBar()
# actions = menu_bar.actions()
# lastAction = actions[ len( actions ) - 1 ]
# menu_bar.insertMenu(lastAction, self.menu )
# aggiunge le toolbar
self.toolBar = self.iface.addToolBar(QadMsg.getQADTitle())
self.toolBar.setObjectName(QadMsg.getQADTitle())
self.toolBar.addAction(self.mainAction)
# help
self.helpToolButton = self.createHelpToolButton()
self.toolBar.addWidget(self.helpToolButton)
# aggiunge le toolbar per i comandi
self.toolBar.addAction(self.setCurrLayerByGraph_action)
self.toolBar.addAction(self.setCurrUpdateableLayerByGraph_action)
self.toolBar.addAction(self.u_action)
self.toolBar.addAction(self.redo_action)
self.toolBar.addAction(self.line_action)
self.toolBar.addAction(self.pline_action)
# arco
self.arcToolButton = self.createArcToolButton()
self.toolBar.addWidget(self.arcToolButton)
# cerchio
self.circleToolButton = self.createCircleToolButton()
self.toolBar.addWidget(self.circleToolButton)
# ellisse
self.ellipseToolButton = self.createEllipseToolButton() # da vedere
self.toolBar.addWidget(self.ellipseToolButton)
self.toolBar.addAction(self.rectangle_action)
self.toolBar.addAction(self.polygon_action)
self.toolBar.addAction(self.mpolygon_action)
self.toolBar.addAction(self.mbuffer_action)
self.toolBar.addAction(self.insert_action)
self.toolBar.addAction(self.text_action)
self.toolBar.addAction(self.erase_action)
self.toolBar.addAction(self.rotate_action)
self.toolBar.addAction(self.move_action)
self.toolBar.addAction(self.scale_action)
self.toolBar.addAction(self.copy_action)
# array
self.arrayToolButton = self.createArrayToolButton()
self.toolBar.addWidget(self.arrayToolButton)
self.toolBar.addAction(self.offset_action)
self.toolBar.addAction(self.extend_action)
self.toolBar.addAction(self.trim_action)
self.toolBar.addAction(self.mirror_action)
self.toolBar.addAction(self.stretch_action)
self.toolBar.addAction(self.lengthen_action)
self.toolBar.addAction(self.divide_action)
self.toolBar.addAction(self.measure_action)
# break
self.breakToolButton = self.createBreakToolButton()
self.toolBar.addWidget(self.breakToolButton)
self.toolBar.addAction(self.pedit_action)
self.toolBar.addAction(self.mapmpedit_action)
self.toolBar.addAction(self.fillet_action)
self.toolBar.addAction(self.join_action)
self.toolBar.addAction(self.disjoin_action)
self.toolBar.addAction(self.id_action)
self.toolBar.addAction(self.dsettings_action)
self.toolBar.addAction(self.options_action)
self.enableUndoRedoButtons()
# aggiunge la toolbar per la quotatura
self.dimToolBar = self.createDimToolBar()
# Inizializzo la finestra di testo
self.TextWindow = QadTextWindow(self)
self.TextWindow.initGui()
isFloating, dockGeometry, dockWidgetArea = self.TextWindow.readDockWidgetSettings()
self.TextWindow.setFloating(isFloating)
if isFloating == False:
# ugly hack, but only way to set dock size correctly for Qt < 5.6
self.TextWindow.setFixedSize(dockGeometry.size())
self.iface.addDockWidget(dockWidgetArea, self.TextWindow)
self.TextWindow.resize(dockGeometry.size())
QgsApplication.processEvents() # required!
self.TextWindow.setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
else:
self.TextWindow.setGeometry(dockGeometry)
self.iface.addDockWidget(dockWidgetArea, self.TextWindow)
# aggiungo i segnali di aggiunta e rimozione di layer per collegare ogni layer
# all'evento <layerModified> per sapere se la modifica fatta su quel layer
# é stata fatta da QAD o dall'esterno
# per i layer esistenti
for layer in QgsProject.instance().mapLayers().values():
self.layerAdded(layer)
self.removeLayer(layer.id())
# per i layer futuri
QgsProject.instance().layerWasAdded.connect(self.layerAdded)
QgsProject.instance().layerWillBeRemoved[QgsMapLayer].connect(self.layerAdded)
self.iface.projectRead.connect(self.onProjectLoaded)
self.iface.newProjectCreated.connect(self.onProjectLoaded)
self.showTextWindow(QadVariables.get(QadMsg.translate("Environment variables", "SHOWTEXTWINDOW"), True))
self.setStandardMapTool()
#QMessageBox.warning(None, "titolo" , 'altezza dopo addDockWidget ' + str(self.TextWindow.height()))
def unload(self):
self.abortCommand()
# Disconnect to signals
self.canvas.mapToolSet.disconnect(self.deactivate)
QgsProject.instance().layerWasAdded.disconnect(self.layerAdded)
QgsProject.instance().layerWillBeRemoved[QgsMapLayer].disconnect(self.layerAdded)
self.iface.projectRead.disconnect(self.onProjectLoaded)
self.iface.newProjectCreated.disconnect(self.onProjectLoaded)
# Remove the plugin menu item and icon
self.iface.removePluginVectorMenu("&QAD", self.mainAction)
self.iface.removeToolBarIcon(self.mainAction)
# remove toolbars and menubars
if self.toolBar is not None:
del self.toolBar
if self.dimToolBar is not None:
del self.dimToolBar
if self.menu is not None:
del self.menu
if self.TextWindow is not None:
self.TextWindow.writeDockWidgetSettings()
self.TextWindow.setVisible(False)
self.iface.removeDockWidget(self.TextWindow)
del self.TextWindow
self.TextWindow = None
if self.tool:
if self.canvas.mapTool() == self.tool:
self.canvas.unsetMapTool(self.tool)
elif self.QadCommands.actualCommand is not None:
if self.canvas.mapTool() == self.QadCommands.actualCommand.getPointMapTool():
self.canvas.unsetMapTool(self.QadCommands.actualCommand.getPointMapTool())
self.tool.removeItems()
del self.tool
del self.QadCommands
def onProjectLoaded(self):
self.initOnProjectLoaded()
self.showTextWindow(QadVariables.get(QadMsg.translate("Environment variables", "SHOWTEXTWINDOW"), True))
self.setStandardMapTool()
# ============================================================================
# INIZIO - Gestione ACTION (da chiamare prima di creare MENU e TOOLBAR)
# ============================================================================
def initActions(self):
# Creo le azioni e le collego ai comandi
self.mainAction = QAction(QIcon(":/plugins/qad/icons/qad.svg"), \
QadMsg.getQADTitle(), self.iface.mainWindow())
self.mainAction.setCheckable(True)
self.mainAction.triggered.connect(self.run)
# SETCURRLAYERBYGRAPH
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "SETCURRLAYERBYGRAPH"))
self.setCurrLayerByGraph_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.setCurrLayerByGraph_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.setCurrLayerByGraph_action)
# SETCURRUPDATEABLELAYERBYGRAPH
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "SETCURRUPDATEABLELAYERBYGRAPH"))
self.setCurrUpdateableLayerByGraph_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.setCurrUpdateableLayerByGraph_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.setCurrUpdateableLayerByGraph_action)
# ARC BY 3 POINTS (MACRO)
self.arcBy3Points_action = QAction(QIcon(":/plugins/qad/icons/arcBy3Points.svg"), \
QadMsg.translate("Command_ARC", "Arc passing through 3 points"), \
self.iface.mainWindow())
self.arcBy3Points_action.triggered.connect(self.runARCBY3POINTSCommand)
# ARC BY START CENTER END POINTS (MACRO)
self.arcByStartCenterEndPoints_action = QAction(QIcon(":/plugins/qad/icons/arcByStartCenterEndPoints.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, central and final points"), \
self.iface.mainWindow())
self.arcByStartCenterEndPoints_action.triggered.connect(self.runARC_BY_START_CENTER_END_Command)
# ARC BY START CENTER ANGLE (MACRO)
self.arcByStartCenterAngle_action = QAction(QIcon(":/plugins/qad/icons/arcByStartCenterAngle.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, central points and angle"), \
self.iface.mainWindow())
self.arcByStartCenterAngle_action.triggered.connect(self.runARC_BY_START_CENTER_ANGLE_Command)
# ARC BY START CENTER LENGTH (MACRO)
self.arcByStartCenterLength_action = QAction(QIcon(":/plugins/qad/icons/arcByStartCenterLength.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, central points and cord length"), \
self.iface.mainWindow())
self.arcByStartCenterLength_action.triggered.connect(self.runARC_BY_START_CENTER_LENGTH_Command)
# ARC BY START END ANGLE (MACRO)
self.arcByStartEndAngle_action = QAction(QIcon(":/plugins/qad/icons/arcByStartEndAngle.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, final points and angle"), \
self.iface.mainWindow())
self.arcByStartEndAngle_action.triggered.connect(self.runARC_BY_START_END_ANGLE_Command)
# ARC BY START END TAN (MACRO)
self.arcByStartEndTan_action = QAction(QIcon(":/plugins/qad/icons/arcByStartEndTan.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, final points and tangent"), \
self.iface.mainWindow())
self.arcByStartEndTan_action.triggered.connect(self.runARC_BY_START_END_TAN_Command)
# ARC BY START END RADIUS (MACRO)
self.arcByStartEndRadius_action = QAction(QIcon(":/plugins/qad/icons/arcByStartEndRadius.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by start, final points and radius"), \
self.iface.mainWindow())
self.arcByStartEndRadius_action.triggered.connect(self.runARC_BY_START_END_RADIUS_Command)
# ARC BY CENTER START END (MACRO)
self.arcByCenterStartEnd_action = QAction(QIcon(":/plugins/qad/icons/arcByCenterStartEnd.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by central, start and final points"), \
self.iface.mainWindow())
self.arcByCenterStartEnd_action.triggered.connect(self.runARC_BY_CENTER_START_END_Command)
# ARC BY CENTER START ANGLE (MACRO)
self.arcByCenterStartAngle_action = QAction(QIcon(":/plugins/qad/icons/arcByCenterStartAngle.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by central, start points and angle"), \
self.iface.mainWindow())
self.arcByCenterStartAngle_action.triggered.connect(self.runARC_BY_CENTER_START_ANGLE_Command)
# ARC BY CENTER START LENGTH (MACRO)
self.arcByCenterStartLength_action = QAction(QIcon(":/plugins/qad/icons/arcByCenterStartLength.svg"), \
QadMsg.translate("Command_ARC", "Arc defined by central, start points and cord length"), \
self.iface.mainWindow())
self.arcByCenterStartLength_action.triggered.connect(self.runARC_BY_CENTER_START_LENGTH_Command)
# ARRAYRECT
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "ARRAYRECT"))
self.arrayRect_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.arrayRect_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.arrayRect_action)
# ARRAYPATH
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "ARRAYPATH"))
self.arrayPath_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.arrayPath_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.arrayPath_action)
# ARRAYPOLAR (MACRO)
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "ARRAYPOLAR"))
self.arrayPolar_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.arrayPolar_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.arrayPolar_action)
# BREAK
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "BREAK"))
self.break_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.break_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.break_action)
# BREAK BY 1 POINT (MACRO)
self.breakBy1Point_action = QAction(QIcon(":/plugins/qad/icons/breakBy1Point.svg"), \
QadMsg.translate("Command_BREAK", "Breaks an object at one point"), \
self.iface.mainWindow())
self.breakBy1Point_action.triggered.connect(self.runBREAK_BY_1_POINT_Command)
# CIRCLE BY CENTER RADIUS (MACRO)
self.circleByCenterRadius_action = QAction(QIcon(":/plugins/qad/icons/circleByCenterRadius.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by central point and radius"), \
self.iface.mainWindow())
self.circleByCenterRadius_action.triggered.connect(self.runCIRCLE_BY_CENTER_RADIUS_Command)
# CIRCLE BY CENTER DIAMETER (MACRO)
self.circleByCenterDiameter_action = QAction(QIcon(":/plugins/qad/icons/circleByCenterDiameter.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by central point and diameter"), \
self.iface.mainWindow())
self.circleByCenterDiameter_action.triggered.connect(self.runCIRCLE_BY_CENTER_DIAMETER_Command)
# CIRCLE BY 2 POINTS (MACRO)
self.circleBy2Points_action = QAction(QIcon(":/plugins/qad/icons/circleBy2Points.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by 2 points"), \
self.iface.mainWindow())
self.circleBy2Points_action.triggered.connect(self.runCIRCLE_BY_2POINTS_Command)
# CIRCLE BY 3 POINTS (MACRO)
self.circleBy3Points_action = QAction(QIcon(":/plugins/qad/icons/circleBy3Points.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by 3 points"), \
self.iface.mainWindow())
self.circleBy3Points_action.triggered.connect(self.runCIRCLE_BY_3POINTS_Command)
# CIRCLE BY TANGEN TANGENT RADIUS (MACRO)
self.circleBy2TansRadius_action = QAction(QIcon(":/plugins/qad/icons/circleBy2TansRadius.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by 2 tangent points and radius"), \
self.iface.mainWindow())
self.circleBy2TansRadius_action.triggered.connect(self.runCIRCLE_BY_2TANS_RADIUS_Command)
# CIRCLE BY TANGEN TANGENT TANGENT (MACRO)
self.circleBy3Tans_action = QAction(QIcon(":/plugins/qad/icons/circleBy3Tans.svg"), \
QadMsg.translate("Command_CIRCLE", "Circle defined by 3 tangent points"), \
self.iface.mainWindow())
self.circleBy3Tans_action.triggered.connect(self.runCIRCLE_BY_3TANS_Command)
# COPY
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "COPY"))
self.copy_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.copy_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.copy_action)
# DIMALIGNED
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIMALIGNED"))
self.dimAligned_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dimAligned_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dimAligned_action)
# DIMLINEAR
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIMLINEAR"))
self.dimLinear_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dimLinear_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dimLinear_action)
# DIMARC
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIMARC"))
self.dimArc_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dimArc_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dimArc_action)
# DIMRADIUS
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIMRADIUS"))
self.dimRadius_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dimRadius_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dimRadius_action)
# DIMSTYLE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIMSTYLE"))
self.dimStyle_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dimStyle_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dimStyle_action)
# DSETTINGS
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DSETTINGS"))
self.dsettings_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.dsettings_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.dsettings_action)
# DISJOIN
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DISJOIN"))
self.disjoin_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.disjoin_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.disjoin_action)
# DIVIDE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "DIVIDE"))
self.divide_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.divide_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.divide_action)
# ELLIPSE BY CENTER 2 POINTS (MACRO)
self.ellipseByCenter2Points_action = QAction(QIcon(":/plugins/qad/icons/ellipseByCenter2Points.svg"), \
QadMsg.translate("Command_ELLIPSE", "Ellipse defined by central point"), \
self.iface.mainWindow())
self.ellipseByCenter2Points_action.triggered.connect(self.runELLIPSE_BY_CENTER_2_POINTS_Command)
# ELLIPSE BY AXIS1
self.ellipse_action = QAction(QIcon(":/plugins/qad/icons/ellipseByAxis1Point.svg"), \
QadMsg.translate("Command_ELLIPSE", "Creates an ellipse or an elliptical arc"), \
self.iface.mainWindow())
self.ellipse_action.triggered.connect(self.runELLIPSECommand)
# ELLIPTICAL ARC (MACRO)
self.ellipticalArc_action = QAction(QIcon(":/plugins/qad/icons/ellipseArc.svg"), \
QadMsg.translate("Command_ELLIPSE", "Creates an elliptical arc"), \
self.iface.mainWindow())
self.ellipticalArc_action.triggered.connect(self.runELLIPTICAL_ARC_Command)
# ELLIPSE BY FOCI (MACRO)
self.ellipseByFoci_action = QAction(QIcon(":/plugins/qad/icons/ellipseByFociPoint.svg"), \
QadMsg.translate("Command_ELLIPSE", "Creates an ellipse by foci"), \
self.iface.mainWindow())
self.ellipseByFoci_action.triggered.connect(self.runELLIPSE_BY_FOCI_Command)
# ERASE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "ERASE"))
self.erase_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.erase_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.erase_action)
# EXTEND
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "EXTEND"))
self.extend_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.extend_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.extend_action)
# FILLET
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "FILLET"))
self.fillet_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.fillet_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.fillet_action)
# HELP
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "HELP"))
self.help_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.help_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.help_action)
# ID
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "ID"))
self.id_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.id_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.id_action)
# INSERT
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "INSERT"))
self.insert_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.insert_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.insert_action)
# JOIN
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "JOIN"))
self.join_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.join_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.join_action)
# LENGTHEN
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "LENGTHEN"))
self.lengthen_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.lengthen_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.lengthen_action)
# LINE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "LINE"))
self.line_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.line_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.line_action)
# MAPMPEDIT
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MAPMPEDIT"))
self.mapmpedit_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.mapmpedit_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.mapmpedit_action)
# MBUFFER
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MBUFFER"))
self.mbuffer_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.mbuffer_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.mbuffer_action)
# MEASURE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MEASURE"))
self.measure_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.measure_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.measure_action)
# MIRROR
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MIRROR"))
self.mirror_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.mirror_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.mirror_action)
# MOVE
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MOVE"))
self.move_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())
self.move_action.setToolTip(cmd.getToolTipText())
cmd.connectQAction(self.move_action)
# MPOLYGON
cmd = self.QadCommands.getCommandObj(QadMsg.translate("Command_list", "MPOLYGON"))
self.mpolygon_action = QAction(cmd.getIcon(), cmd.getName(), self.iface.mainWindow())