Skip to content

Commit d7166df

Browse files
author
Alexander.Golyshkin
committed
Added Polarion documentation (integration chapter) support (#1)
1 parent 22ec8e2 commit d7166df

7 files changed

+82
-6
lines changed

DbcCheckMain.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import threading
22

3-
from ui.DbcCheckUiApplication import *
43
from checkers.DbcMsgDuplicatesChecker import *
4+
from checkers.DbcMsgCheckWithPolarionIntegration import DbcMsgCheckWithPolarionIntegration
55
from checkers.DbcNodesChecker import *
66
from checkers.DbcSigDuplicatesChecker import DbcSigDuplicatesChecker
7-
from common.DbcCheckUtils import LOGGER
7+
from ui.DbcCheckUiApplication import *
88

99
def onStartCheckCallback( aSelectedPath: str ):
1010
thread = threading.Thread( target=startDBCCheckThread, args=[ aSelectedPath ] )
@@ -25,6 +25,9 @@ def startDBCCheckThread( aSelectedPath: str ):
2525
if DbcCheckConfig.CONF_CHECK_SIG_SPN_DUPLICATION:
2626
dbcCheckEngine.addChecker( DbcSigDuplicatesChecker() )
2727

28+
if DbcCheckConfig.CONF_USE_POLARION_INTEGRATIONS_FOR_CHECK_SIGNALS:
29+
dbcCheckEngine.addChecker( DbcMsgCheckWithPolarionIntegration() )
30+
2831
dbcCheckEngine.startCheck()
2932

3033
def outputCallback( textOutput ):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import xml.etree.ElementTree as ET
2+
from os import path
3+
4+
from common import DbcCheckConfig
5+
from common.DbcCheckUtils import LOGGER
6+
from interfaces.DbcCheckerInterface import *
7+
8+
class DbcMsgCheckWithPolarionIntegration( DbcCheckerInterface ):
9+
CONFIG: dict = { }
10+
11+
def __init__( self ):
12+
DbcMsgCheckWithPolarionIntegration.initConfig()
13+
14+
@staticmethod
15+
def initConfig() -> None:
16+
"""
17+
Process configuration.xml file
18+
19+
:return dictionary
20+
"""
21+
if path.exists( DbcCheckConfig.APP_CONFIG_XML_PATH ):
22+
rootNode = ET.parse( DbcCheckConfig.APP_CONFIG_XML_PATH ).getroot()
23+
24+
DbcMsgCheckWithPolarionIntegration.CONFIG[ "polarionUrl" ] = rootNode.findtext( "polarionUrl" )
25+
DbcMsgCheckWithPolarionIntegration.CONFIG[ "polarionLogin" ] = rootNode.findtext( "polarionLogin" )
26+
DbcMsgCheckWithPolarionIntegration.CONFIG[ "polarionPwd" ] = rootNode.findtext( "polarionPwd" )
27+
28+
documentLocations = [ ]
29+
for documentLocation in rootNode.findall( 'documentLocations/documentLocation' ):
30+
documentLocations.append( documentLocation.text )
31+
32+
DbcMsgCheckWithPolarionIntegration.CONFIG[ "documentLocations" ] = documentLocations
33+
else:
34+
LOGGER.error( f"{DbcCheckConfig.APP_CONFIG_XML_PATH} is not exists" )
35+
36+
def processDbcFile( self, aDataBase: candb.Database, aDbcPath: str ) -> None:
37+
pass
38+
39+
def processMessage( self, aMessage: Message ) -> None:
40+
pass
41+
42+
def processSignal( self, aSignal: Signal ) -> None:
43+
pass
44+
45+
def printReport( self ) -> None:
46+
pass
47+
48+
def onFinish( self ) -> None:
49+
pass
50+
51+
def onStart( self ) -> None:
52+
LOGGER.info( "DBC Polarion Integrations Checker Registered." )

common/DbcCheckConfig.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Configuration file for Vector DBCChecker
2-
import logging
32

43
APP_VER: float = 1.2
54
APP_TITLE: str = "Vector DBCChecker Application"
65
APP_ABOUT_INFO: str = "This is application checks a vector based DBC files on consistency and messages duplicates.\n\n(c) Alexander.Golyshkin 2023"
6+
APP_CONFIG_XML_PATH: str = "configuration.xml"
77
APP_WIN_SIZE_APP_WIDTH: int = 800
88
APP_WIN_SIZE_APP_HEIGHT: int = 600
99
APP_WIN_SIZE_SETTINGS_WIDTH: int = 380
@@ -15,9 +15,9 @@
1515
CONF_CHECK_OVERLAP_SIGNALS: bool = True
1616
CONF_CHECK_MISSED_NETWORK_NODES: bool = True
1717
CONF_CHECK_DB_VERSION: bool = True
18+
CONF_USE_POLARION_INTEGRATIONS_FOR_CHECK_SIGNALS: bool = False
1819
CONF_LOG_FILE_NAME: str = "dbc-check.log"
1920
CONF_PAD_DX: int = 5
2021
CONF_PAD_DY: int = 5
2122
# By default, is expected an Intel byte order in signals
2223
SIGNAL_BYTE_ORDER: str = "little_endian"
23-

common/DbcCheckUtils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from tkinter import Wm, Misc
23

34
from common.DbcCheckConfig import *
@@ -13,4 +14,7 @@ def centerWindow( aRoot: (Misc, Wm), width=300, height=200 ):
1314
# calculate position x and y coordinates
1415
x = (screen_width / 2) - (width / 2)
1516
y = (screen_height / 2) - (height / 2)
16-
aRoot.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
17+
# Change size & position
18+
# aRoot.geometry( '%dx%d+%d+%d' % (width, height, x, y) )
19+
# Just change a position
20+
aRoot.geometry( '+%d+%d' % (x, y) )

configuration.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration ver="1.0">
3+
<polarionUrl>http://polarion.arrival.dc/polarion</polarionUrl>
4+
<polarionLogin>[email protected]</polarionLogin>
5+
<polarionPwd>****</polarionPwd>
6+
<documentLocations>
7+
<!--
8+
<documentLocation>features_DomainHMI_SAFENOTIFY_Architecture_Specification/SAFENOTIFY_Architecture_Specification</documentLocation>
9+
-->
10+
<documentLocation>features_DomainHMI_NAV_Architecture_Specification/NAV_Architecture_Specification</documentLocation>
11+
</documentLocations>
12+
</configuration>

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cantools
2-
polarion~=1.0.0
2+
polarion~=1.1.0

ui/DbcCheckUiSettings.py

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__( self, aRoot: Tk ):
2020
self.isCheckSigSpnDuplicationValue = BooleanVar( value=DbcCheckConfig.CONF_CHECK_SIG_SPN_DUPLICATION )
2121
self.isCheckDbVersionValue = BooleanVar( value=DbcCheckConfig.CONF_CHECK_DB_VERSION )
2222
self.signalByteOrder = StringVar( value=DbcCheckConfig.SIGNAL_BYTE_ORDER )
23+
self.usePolarionFasIntegrationsForCheckSignalsValue = BooleanVar( value=DbcCheckConfig.CONF_USE_POLARION_INTEGRATIONS_FOR_CHECK_SIGNALS )
2324

2425
def configureUi( self ) -> None:
2526
self.checkMsgDuplicationCheckBox = Checkbutton( master=self.frame, text="Check Messages Duplication", variable=self.isCheckMsgDuplicationValue, command=self.onSettingsChange )
@@ -40,6 +41,9 @@ def configureUi( self ) -> None:
4041
self.ignoreMsgDupWithSameSignalsCheckBox = Checkbutton( master=self.frame, text="Ignore Messages Duplication for the Same Signals", variable=self.isIgnoreMsgDupWithSameSignalsValue, command=self.onSettingsChange )
4142
self.ignoreMsgDupWithSameSignalsCheckBox.grid( row=5, column=0, padx=DbcCheckConfig.CONF_PAD_DX, sticky="W" )
4243

44+
self.usePolarionFasIntegrationsForCheckSignalsCheckBox = Checkbutton( master=self.frame, text="Use Polarion Integration Info for check signals", variable=self.usePolarionFasIntegrationsForCheckSignalsValue, command=self.onSettingsChange )
45+
self.usePolarionFasIntegrationsForCheckSignalsCheckBox.grid( row=6, column=0, padx=DbcCheckConfig.CONF_PAD_DX, sticky="W" )
46+
4347
radioFrame = Frame( self.frame )
4448
radioFrame.grid( sticky="NEWS" )
4549

@@ -68,6 +72,7 @@ def onSettingsChange( self ) -> None:
6872
DbcCheckConfig.CONF_CHECK_SIG_SPN_DUPLICATION = self.isCheckSigSpnDuplicationValue.get()
6973
DbcCheckConfig.isCheckDbVersionValue = self.isCheckDbVersionValue.get()
7074
DbcCheckConfig.SIGNAL_BYTE_ORDER = self.signalByteOrder.get()
75+
DbcCheckConfig.CONF_USE_POLARION_INTEGRATIONS_FOR_CHECK_SIGNALS = self.usePolarionFasIntegrationsForCheckSignalsValue.get()
7176

7277
def onApplySettings( self ) -> None:
7378
# Do nothing all things are applied automatically now

0 commit comments

Comments
 (0)