1
2
3
4
5
6
7
8
9
10
11 from PyQt4.QtCore import *
12 from PyQt4.QtGui import *
13
14 from constants import *
15 from tools import *
16 from grid import *
17 from rubberband import *
18 from line import *
19
20 import pickle
21
23
25 QGraphicsRectItem.__init__(self, parent)
26
27 self._parent = parent
28
29 self._title = ''
30 self._font = QFont()
31 self._font.setBold(True)
32
33 self.setHeight(QFontMetrics(self._font).height() * 1.5)
34 self._backgroundColor = QColor(239, 239, 239)
35 self.setZValue(0)
36
38 '''
39 Yüksekliğini bildirir
40 '''
41 return self.rect().height()
42
44 '''
45 Yüksekliğini değiştirir.
46 '''
47 rect = self.rect()
48 rect.setHeight(newHeight)
49 self.prepareGeometryChange()
50 self.setRect(rect)
51
53 '''
54 Genişliğini değiştirir.
55 '''
56 rect = self.rect()
57 rect.setWidth(newWidth)
58 self.prepareGeometryChange()
59 self.setRect(rect)
60
62 '''
63 Y koordinatını değiştirir.
64 '''
65 pos = self.pos()
66 pos.setY(newY)
67
68 self.setPos(pos)
69
71 '''
72 Çerçevenin başlığını belirler.
73 '''
74 self._title = tr(title)
75 self.update()
76
78 '''
79 Çerçevenin başlığını döndürür.
80 '''
81 return self._title
82
84 '''
85 Çerçeve başlığını çizer.
86 '''
87 rect = self.rect()
88
89 bgColor = self._backgroundColor
90
91
92 x1 = rect.x()
93 y1 = rect.y()
94 x2 = x1 + rect.height()
95 y2 = y1 + rect.height()
96 gradient = QLinearGradient(x1, y1, x1, y2)
97 gradient.setSpread(QGradient.PadSpread)
98 gradient.setColorAt(0, bgColor.light(150))
99 gradient.setColorAt(0.25, bgColor)
100 gradient.setColorAt(0.75, bgColor.light(150))
101 gradient.setColorAt(1, bgColor.dark(150))
102 painter.setBrush(QBrush(gradient))
103 painter.setPen(QPen(Qt.NoPen))
104 painter.drawRect(self.rect())
105
106
107 painter.setPen(QPen(Qt.lightGray))
108 painter.drawLine(x1, y1, x1 + rect.width(), y1)
109 painter.drawLine(x1, y2, x1 + rect.width(), y2)
110
111
112 painter.setPen(Qt.black)
113 painter.setFont(self._font)
114 textFlags = Qt.AlignLeft | Qt.AlignVCenter
115 textRect = self.rect().adjusted(5, 0, 0, 0)
116 painter.drawText(textRect, textFlags, self._title)
117
118 -class FrameBody(QGraphicsRectItem):
119
120 - def __init__(self, parent, editor, plugin):
121 QGraphicsRectItem.__init__(self, parent)
122
123 self._parent = parent
124 self._grid = Grid(plugin)
125 self._plugin = plugin
126 self._editor = editor
127
128
129 self.setAcceptDrops(True)
130 self.setZValue(0)
131
132
133 self._rubberBanding = False
134 self._rubberBand = None
135 self._mousePressPoint = None
136
137
138 self.connectSignals()
139
140 - def connectSignals(self):
141 '''
142 Gerekli sinyalleri scene oluştuktan sonra bağlar.
143 '''
144 if self.scene():
145
146 self.scene().connect(self._editor, SIGNAL('editorModeChanged(int)'), self.editorModeChanged)
147
148 else:
149 QTimer.singleShot(0.1, self.connectSignals)
150
151 - def editorModeChanged(self, newMode):
152 '''
153 Editördeki mod değişikliğine göre gerekli ayarları değiştiriyoruz.
154 '''
155 from editor import Editor
156
157 if newMode in (Editor.MODE_ADDLABEL, Editor.MODE_ADDLINE, Editor.MODE_FORMULA, \
158 Editor.MODE_ADDLINECHARACTER, Editor.MODE_ADDRECTANGLE, \
159 Editor.MODE_ADDIMAGE, Editor.MODE_ADDBARCODE, ):
160
161 self.setCursor(Qt.CrossCursor)
162
163 else:
164 self.unsetCursor()
165
167 '''
168 Yüksekliğini bildirir
169 '''
170 return self.rect().height()
171
173 '''
174 Genişliğini bildirir
175 '''
176 return self.rect().width()
177
178 - def setHeight(self, newHeight):
179 '''
180 Yüksekliğini değiştirir.
181 '''
182 rect = self.rect()
183 rect.setHeight(newHeight + self._plugin.frameBodyMargin())
184
185 self.prepareGeometryChange()
186 self.setRect(rect)
187
188 - def setWidth(self, newWidth):
189 '''
190 Genişliğini değiştirir.
191 '''
192 rect = self.rect()
193 rect.setWidth(newWidth)
194
195 self.prepareGeometryChange()
196 self.setRect(rect)
197
198 - def frameCode(self):
199 '''
200 Çerçeve kodunu döndürür.
201 '''
202 return self._parent.frameCode()
203
204 - def setY(self, newY):
205 '''
206 Y koordinatını değiştirir.
207 '''
208 pos = self.pos()
209 pos.setY(newY)
210
211 self.setPos(pos)
212
213 - def dragEnterEvent(self, e):
214 '''
215 Sürüklenen alanın kabul edilip edilmeyeceğini bildirir.
216 '''
217 mimeFormat = e.mimeData().formats()[0]
218
219 if '-' in mimeFormat:
220 fieldStatus = mimeFormat.split('-')[-2]
221 fieldType = mimeFormat.split('-')[-1]
222
223 if self._parent.acceptsFieldStatus(fieldStatus, fieldType):
224 e.acceptProposedAction()
225
226 else:
227 e.ignore()
228
229 else:
230 e.ignore()
231
232 - def dragMoveEvent(self, e):
233 '''
234 Sürüklenen alanı çerçeve dışına çıkmayacak şekilde kabul eder.
235 '''
236 mimeFormat = e.mimeData().formats()[0]
237
238 if '-' in mimeFormat:
239 fieldStatus = mimeFormat.split('-')[-2]
240 fieldType = mimeFormat.split('-')[-1]
241
242 if self._parent.acceptsFieldStatus(fieldStatus, fieldType):
243
244 itemPos = e.scenePos()
245 itemWidth = self._plugin.unit().pointWidth(self._plugin.defaultFieldWidth())
246 itemHeight = self._plugin.unit().pointHeight(self._plugin.defaultFieldHeight())
247 itemRect = QRectF(itemPos, QSizeF(itemWidth, itemHeight))
248
249 framePos = self.scenePos()
250 frameSize = self.rect().size()
251 frameRect = QRectF(framePos, frameSize)
252
253 if frameRect.contains(itemRect):
254 e.acceptProposedAction()
255
256 else:
257 e.ignore()
258
259 else:
260 e.ignore()
261
262 else:
263 e.ignore()
264
265 - def dropEvent(self, e):
266 '''
267 Sürüklenen alanı uygunsa kabul edip editor üzerinde alanı oluşturur.
268 '''
269 mimeFormat = e.mimeData().formats()[0]
270
271 if '-' in mimeFormat:
272 fieldStatus = mimeFormat.split('-')[-2]
273 fieldType = mimeFormat.split('-')[-1]
274
275 if self._parent.acceptsFieldStatus(fieldStatus, fieldType):
276 e.acceptProposedAction()
277 fieldAttributes = pickle.loads(e.mimeData().data(mimeFormat))
278
279
280 pos = e.pos()
281
282
283 if self._plugin.requiresGridPosition():
284 pos = self._plugin.alignToGrid(pos)
285
286 self.scene().emit(SIGNAL('newFieldDragged(PyQt_PyObject, PyQt_PyObject, QPointF)'),
287 self, fieldAttributes, pos)
288
289 else:
290 e.ignore()
291
292 else:
293 e.ignore()
294
295 - def mousePressEvent(self, e):
296 '''
297 Seçim çerçevesi çizmek için gerekli tanımları yapar.
298 '''
299 from editor import Editor
300
301
302 if self._editor.mode() == Editor.MODE_ADDLABEL and self._plugin.requiresGridPosition():
303 dx = self._plugin.gridDx()
304 dy = self._plugin.gridDy()
305 x = e.pos().x()
306 y = e.pos().y()
307 x = x - x % dx + 1
308 y = y - y % dy + 1
309 topLeft = QPointF(x, y)
310 size = QSizeF(dx, dy)
311
312 self.scene().emit(SIGNAL('newTextArea(PyQt_PyObject, QPointF, QSizeF)'), self, topLeft, size)
313
314
315 elif self._editor.mode() == Editor.MODE_FORMULA and self._plugin.requiresGridPosition():
316 dx = self._plugin.gridDx()
317 dy = self._plugin.gridDy()
318 x = e.pos().x()
319 y = e.pos().y()
320 x = x - x % dx + 1
321 y = y - y % dy + 1
322 topLeft = QPointF(x, y)
323 frameCode = self._parent.frameCode()
324 width = self._plugin.unit().pointWidth(self._plugin.defaultFieldWidth())
325 height = self._plugin.unit().pointHeight(self._plugin.defaultFieldHeight())
326 size = QSizeF(width, height)
327
328 self.scene().emit(SIGNAL('newFormula(PyQt_PyObject, PyQt_PyObject, QPointF, QSizeF)'), self, frameCode, topLeft, size)
329
330
331 elif self._editor.mode() == Editor.MODE_ADDLINECHARACTER and self._plugin.requiresGridPosition():
332 dx = self._plugin.gridDx()
333 dy = self._plugin.gridDy()
334 x = e.pos().x()
335 y = e.pos().y()
336 x = x - x % dx + 1
337 y = y - y % dy + 1
338 topLeft = QPointF(x, y)
339 size = QSizeF(dx, dy)
340 text = self._editor.addLineCharacter()
341
342 self.scene().emit(SIGNAL('newTextArea(PyQt_PyObject, QPointF, QSizeF, PyQt_PyObject)'), self, topLeft, size, text)
343
344 else:
345 self._rubberBanding = True
346 self._mousePressPoint = e.pos()
347
348 if self.scene():
349 self.scene().clearSelection()
350
351 - def mouseMoveEvent(self, e):
352 '''
353 Mouse ile oynadıkça gerekli seçim çerçevesini uyarlar.
354 '''
355 from editor import Editor
356
357 if self._rubberBanding:
358
359 if not self._rubberBand:
360
361
362 if (self._mousePressPoint - e.pos()).toPoint().manhattanLength() < qApp.startDragDistance():
363 return
364
365
366 if self._editor.mode() == Editor.MODE_ADDLINE:
367 self._rubberBand = RubberBand(RubberBand.LINE, self, self._plugin)
368
369 elif self._editor.mode() in (Editor.MODE_ADDLABEL, Editor.MODE_ADDRECTANGLE, \
370 Editor.MODE_ADDIMAGE, Editor.MODE_FORMULA, Editor.MODE_ADDBARCODE):
371
372 self._rubberBand = RubberBand(RubberBand.RECTANGLE, self, self._plugin)
373
374 else:
375 self._rubberBand = RubberBand(RubberBand.SELECTION, self, self._plugin)
376
377 self._rubberBand.setZValue(self._editor.getNextZ())
378
379
380 topLeft = self._mousePressPoint
381 bottomRight = e.pos()
382 x = max(0, min(bottomRight.x(), self.width()))
383 y = max(0, min(bottomRight.y(), self.height()))
384 bottomRight.setY(y)
385 bottomRight.setX(x)
386
387 diff = bottomRight - topLeft
388 size = QSizeF(diff.x(), diff.y())
389 selectionRect = QRectF(topLeft, size)
390
391 if self._editor.mode() != Editor.MODE_ADDLINE:
392 selectionRect = selectionRect.normalized()
393
394 self._rubberBand.setGeometry(selectionRect)
395
396 if self._editor.mode() == Editor.MODE_SELECT:
397 selectionArea = QPainterPath()
398 selectionArea.addPolygon(self.mapToScene(selectionRect))
399 if self.scene():
400 self.scene().setSelectionArea(selectionArea)
401
402 if not self._rubberBand.isVisible():
403 self._rubberBand.show()
404
405 return
406
407 - def mouseReleaseEvent(self, e):
408 '''
409 Seçim çerçevesini kaldırır.
410 '''
411 from editor import Editor
412
413 if self._rubberBanding and self._rubberBand:
414
415 if self._editor.mode() == Editor.MODE_ADDLABEL:
416 size = self._rubberBand.rect().size()
417 topLeft = self._rubberBand.pos()
418
419 self.scene().emit(SIGNAL('newTextArea(PyQt_PyObject, QPointF, QSizeF)'), self, topLeft, size)
420
421 elif self._editor.mode() == Editor.MODE_ADDIMAGE:
422 size = self._rubberBand.rect().size()
423 topLeft = self._rubberBand.pos()
424
425 self.scene().emit(SIGNAL('newImage(PyQt_PyObject, QPointF, QSizeF)'), self, topLeft, size)
426
427 elif self._editor.mode() == Editor.MODE_ADDBARCODE:
428 size = self._rubberBand.rect().size()
429 topLeft = self._rubberBand.pos()
430
431 self.scene().emit(SIGNAL('newBarcode(PyQt_PyObject, QPointF, QSizeF)'), self, topLeft, size)
432
433 elif self._editor.mode() == Editor.MODE_ADDRECTANGLE:
434 size = self._rubberBand.rect().size()
435 topLeft = self._rubberBand.pos()
436
437 self.scene().emit(SIGNAL('newRectangle(PyQt_PyObject, QPointF, QSizeF)'), self, topLeft, size)
438
439 elif self._editor.mode() == Editor.MODE_FORMULA:
440 topLeft = self._rubberBand.pos()
441 size = self._rubberBand.rect().size()
442 frameCode = self._parent.frameCode()
443
444 self.scene().emit(SIGNAL('newFormula(PyQt_PyObject, PyQt_PyObject, QPointF, QSizeF)'), self, frameCode, topLeft, size)
445
446
447 elif self._editor.mode() == Editor.MODE_ADDLINE:
448
449 x = self._rubberBand.pos().x()
450 y = self._rubberBand.pos().y()
451
452 width = self._rubberBand.rect().width()
453 height = self._rubberBand.rect().height()
454
455 dx = self._plugin.gridDx()
456 dy = self._plugin.gridDy()
457
458 if width < 0:
459 if abs(width) >= abs(height):
460 x += width
461
462 width = abs(width)
463
464 if height < 0:
465 if abs(height) > abs(width):
466 y += height
467
468 height = abs(height)
469
470
471 if self._plugin.requiresGridPosition():
472 x = x - x % dx + 1
473 y = y - y % dy + 1
474
475 topLeft = QPointF(x, y)
476 size = QSizeF(dx, dy)
477
478
479 if width >= height:
480 width = int(width / dx) + 1
481 text = u'\u2500' * width
482
483 self.scene().emit(SIGNAL('newTextArea(PyQt_PyObject, QPointF, QSizeF, PyQt_PyObject)'), self, topLeft, size, text)
484
485
486 else:
487 height = int(height / dy) + 1
488 text = u'\u2502'
489
490 self._editor.undoStack().beginMacro(tr("Dikey Çizgi Ekleme"))
491
492
493 for i in xrange(height):
494 self.scene().emit(SIGNAL('newTextArea(PyQt_PyObject, QPointF, QSizeF, PyQt_PyObject)'), self, topLeft, size, text)
495 topLeft.setY(topLeft.y() + dy)
496
497 self._editor.undoStack().endMacro()
498
499
500 else:
501 topLeft = QPointF(x, y)
502
503
504 if width >= height:
505 size = QSizeF(width, 2)
506 self.scene().emit(SIGNAL('newLine(PyQt_PyObject, QPointF, QSizeF, PyQt_PyObject)'), self, topLeft, size, Line.LINE_HORIZONTAL)
507
508 else:
509 size = QSizeF(2, height)
510 self.scene().emit(SIGNAL('newLine(PyQt_PyObject, QPointF, QSizeF, PyQt_PyObject)'), self, topLeft, size, Line.LINE_VERTICAL)
511
512 self.scene().removeItem(self._rubberBand)
513 self._rubberBand = None
514 self._rubberBanding = False
515
516 - def paint(self, painter, option, widget):
517 '''
518 Çerçeve başlığını çizer.
519 '''
520 self._grid.drawTo(painter, self.rect())
521
522
524
526 QGraphicsRectItem.__init__(self, parent)
527
528 self._parent = parent
529 self._plugin = plugin
530
531 rect = self.rect()
532 rect.setHeight(6)
533 self.prepareGeometryChange()
534 self.setRect(rect)
535
536 self._backgroundColor = QColor(239, 239, 239)
537 self.setFlags(QGraphicsItem.ItemIsMovable)
538 self.setCursor(Qt.SizeVerCursor)
539
540 self._initialHeight = None
541 self.setZValue(0)
542
544 '''
545 Yüksekliğini bildirir
546 '''
547 return self.rect().height()
548
550 '''
551 Yüksekliğini değiştirir.
552 '''
553 rect = self.rect()
554 rect.setHeight(newHeight)
555
556 self.prepareGeometryChange()
557 self.setRect(rect)
558
560 '''
561 Genişliğini değiştirir.
562 '''
563 rect = self.rect()
564 rect.setWidth(newWidth)
565
566 self.prepareGeometryChange()
567 self.setRect(rect)
568
569 - def setY(self, newY):
570 '''
571 Y koordinatını değiştirir.
572 '''
573 pos = self.pos()
574 pos.setY(newY)
575
576 self.setPos(pos)
577
579 '''
580 Sürüklemeden önceki son pozisyonunu kaydeder.
581 '''
582 QGraphicsRectItem.mousePressEvent(self, e)
583
584 self._initialHeight = self._parent.bodyHeight()
585
587 '''
588 Çerçevenin büyültülüp küçültülmesini sağlar.
589 '''
590 if e.buttons() & Qt.LeftButton and self.flags() & QGraphicsItem.ItemIsMovable:
591 newPos = QPointF(self.mapToParent(e.pos()) - self.matrix().map(e.buttonDownPos(Qt.LeftButton)))
592 self.setPos(newPos)
593
594 heightDiff = (e.scenePos() - e.buttonDownScenePos(Qt.LeftButton)).y()
595 newHeight = self._initialHeight + heightDiff
596
597 if heightDiff < 0:
598 if self.scenePos().y() < self._parent.itemsLowerBound():
599 diffY = self.scenePos().y() - self._parent.itemsLowerBound()
600 newHeight -= diffY
601
602 self._parent.setBodyHeight(newHeight)
603
621
623 '''
624 Alanın herhangi bir özelliği değiştiği zaman çalışır.
625 '''
626 if change == QGraphicsItem.ItemPositionChange and self.scene():
627
628 newPos = value.toPointF()
629 newPos.setX(0)
630
631 return QVariant(newPos)
632
633 return QGraphicsRectItem.itemChange(self, change, value)
634
644
645 - def paint(self, painter, option, widget):
646 '''
647 Çerçevenin yüksekliğini ayarlayacak olan bar.
648 '''
649 rect = self.rect()
650
651 painter.fillRect(rect, QBrush(self._backgroundColor))
652
653 topColor = QColor(self._backgroundColor.dark(200))
654 bottomColor = QColor(self._backgroundColor.light(200))
655
656 ycenter = int(rect.height() / 2)
657 width = int(rect.width())
658
659 for k in xrange(width / 2 - (width / 4), width / 2 + (width / 4), 6):
660 point = rect.topLeft() + QPointF(k, ycenter - 1)
661
662 painter.setPen(topColor)
663 painter.drawLine(point.x(), point.y(), point.x() + 1, point.y())
664 painter.drawPoint(point.x(), point.y() + 1)
665
666 painter.setPen(bottomColor)
667 painter.drawLine(point.x() + 1, point.y() + 2, point.x() + 2, point.y() + 2)
668 painter.drawPoint(point.x() + 2, point.y() + 1)
669
670 x1 = rect.x()
671 x2 = rect.x() + rect.width()
672 y1 = rect.y()
673 y2 = rect.y() + rect.height()
674
675
676 painter.setPen(QPen(Qt.lightGray))
677 painter.drawLine(x1, y1, x1 + rect.width(), y1)
678 painter.drawLine(x1, y2, x1 + rect.width(), y2)
679
680 -class Frame(QGraphicsRectItem):
681 '''
682 Aynı anda, bir çerçevenin hem başlığını hem de içeriğini tutar.
683 '''
684
685 - def __init__(self, editor, frameCode, plugin):
704
706 '''
707 Çerçevenin ana kısmını döndürür.
708 '''
709 return self._body
710
712 '''
713 Çerçevenin çerçeve kodunu döndürür.
714 '''
715 return self._frameCode
716
723
725 '''
726 Çerçevenin başlığını döndürür.
727 '''
728 return self._header.title()
729
731 '''
732 Çerçevenin başlayacağı satırı döndürür.
733 '''
734 return self._frameStart
735
737 '''
738 Çerçevenin başlayacağı satırı değiştirir.
739 '''
740 self._frameStart = newStart
741
750
762
772
773 - def setY(self, newY):
774 '''
775 Çerçevenin başlayacağı Y koordinatını belirler.
776 '''
777 pos = self.pos()
778 pos.setY(newY)
779
780 self.setPos(pos)
781
782 self.layoutParts()
783
785 '''
786 Bir çerçevenin genişliğini değiştirir.
787 '''
788 rect = self.rect()
789 rect.setWidth(newWidth)
790 self.prepareGeometryChange()
791 self.setRect(rect)
792
793 if self._plugin.supportsFrameHeader():
794 self._header.setWidth(newWidth)
795
796 self._body.setWidth(newWidth)
797
798 if self._plugin.supportsFrameHeader():
799 self._resizebar.setWidth(newWidth)
800
801
802 if self.scene():
803 self.scene().emit(SIGNAL('framesChanged()'))
804
806 '''
807 Çerçevenin yüksekliğini verir.
808 '''
809 return self.rect().width()
810
811 - def bodyScenePos(self):
812 '''
813 Çerçevenin body kısmının koordinatlarını verir.
814 '''
815 return self._body.mapToScene(self._body.rect().topLeft())
816
817 - def bodyHeight(self):
818 '''
819 Çerçevenin body kısmının yüksekliğini verir.
820 '''
821 return self._body.rect().height()
822
824 '''
825 Çerçevenin parçalarına göre Y eksen değerleri düzeltilir.
826 '''
827 pos = self.pos()
828 x = pos.x()
829 y = pos.y()
830
831 totalHeight = self._body.height()
832
833 if self._plugin.supportsFrameHeader():
834 totalHeight += self._header.height()
835
836 if self._plugin.supportsFrameResizeBar():
837 totalHeight += self._resizebar.height()
838
839 self.setPos(QPointF(x, y))
840 rect = self.rect()
841 rect.setHeight(totalHeight)
842 self.prepareGeometryChange()
843 self.setRect(rect)
844
845 bodyY = y
846
847 if self._plugin.supportsFrameHeader():
848 self._header.setY(y)
849 bodyY = y + self._header.height()
850
851 self._body.setY(bodyY)
852
853 if self._plugin.supportsFrameResizeBar():
854 self._resizebar.setY(bodyY + self._body.height())
855
856 - def setBodyHeight(self, newHeight):
857 '''
858 Çerçeveye yeni bir uzunluk verir.
859 '''
860
861 self._body.setHeight(newHeight)
862
863
864 if self.scene():
865 self.scene().emit(SIGNAL('framesChanged()'))
866
868 '''
869 Çerçeve içindeki alanların en aşağıdaki scene koordinatı.
870 '''
871 y = self._body.scenePos().y()
872
873 for item in self._body.children():
874 itemBottom = item.scenePos().y() + item.rect().height()
875 if itemBottom > y:
876 y = itemBottom
877
878 return y
879
881 '''
882 Bu çerçevenin hangi tür alanları kabul edip, edemeyeceğini bildirir.
883 '''
884
885
886 if self._frameCode in (Constants.FRAME_CODE_PAGE_TOPINFO, Constants.FRAME_CODE_REPORT_HEADER,
887 Constants.FRAME_CODE_PAGE_HEADER, Constants.FRAME_CODE_PAGE_FOOTER,
888 Constants.FRAME_CODE_REPORT_FOOTER, Constants.FRAME_CODE_PAGE_BOTTOMINFO):
889
890 return (fieldStatus == Constants.FIELD_STATUS_REPORT)
891
892
893 elif self._frameCode == Constants.FRAME_CODE_REPORT_ROWS:
894
895 if fieldStatus == Constants.FIELD_STATUS_ROW:
896 return True
897
898 elif fieldStatus == Constants.FIELD_STATUS_REPORT and fieldType == Constants.FIELD_TYPE_STANDARD:
899 return True
900
901 else:
902 return False
903
904
905 elif self._frameCode.endswith(Constants.FRAME_CODE_DETAIL_HEADER_SUFFIX) \
906 or self._frameCode.endswith(Constants.FRAME_CODE_DETAIL_FOOTER_SUFFIX):
907
908 detailCode = self._frameCode.split('_')[1]
909 acceptableFieldStatus = '%s_%s' % (detailCode, Constants.FIELD_STATUS_DETAILHF)
910
911 if fieldStatus in (acceptableFieldStatus, Constants.FIELD_STATUS_ROW):
912 return True
913
914 elif fieldStatus == Constants.FIELD_STATUS_REPORT and fieldType == Constants.FIELD_TYPE_STANDARD:
915 return True
916
917 else:
918 return False
919
920
921 elif self._frameCode.endswith(Constants.FRAME_CODE_DETAIL_ROWS_SUFFIX):
922
923 detailCode = self._frameCode.split('_')[1]
924 acceptableFieldStatus = '%s_%s' % (detailCode, Constants.FIELD_STATUS_DETAILROW)
925
926 if fieldStatus in (acceptableFieldStatus, Constants.FIELD_STATUS_ROW):
927 return True
928
929 elif fieldStatus == Constants.FIELD_STATUS_REPORT and fieldType == Constants.FIELD_TYPE_STANDARD:
930 return True
931
932 else:
933 return False
934
937