Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions repo/fs_repo_src/seb/test/explains.gwf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="windows-1251"?>
<GWF version="2.0">
<staticSector>
<node type="node/const/relation" idtf="next*" shapeColor="0" id="37298808" parent="0" left="0" top="0" right="39" bottom="25" textColor="164" text_angle="0" text_font="Times New Roman [Arial]" font_size="10" x="395" y="6" haveBus="false">
<content type="0" mime_type="" file_name=""/>
</node>
<node type="node/const/general_node" idtf="first" shapeColor="0" id="37297512" parent="0" left="0" top="0" right="31" bottom="25" textColor="164" text_angle="0" text_font="Times New Roman [Arial]" font_size="10" x="171" y="191" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[������! � ����������� ���������! ���� ����� ��������� ����� �� X]]></content>
</node>
<node type="node/const/general_node" idtf="" shapeColor="0" id="37297368" parent="0" x="285" y="189" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[��� ���� ����� ������� ���� �������� ������ ������� ���� �� ������� �������.]]></content>
</node>
<node type="node/const/general_node" idtf="" shapeColor="0" id="37297224" parent="0" x="423" y="194" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[��� ���� ����� �������� ������������ ���� �������� �� ���� ������ � ������� ����� ������ ����.]]></content>
</node>
<node type="node/const/general_node" idtf="" shapeColor="0" id="37297080" parent="0" x="548" y="205" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[��� ���� ����� ������� ���� ������������� ���� �������� ���, ����� ������� i �� ����������]]></content>
</node>
<node type="node/const/general_node" idtf="" shapeColor="0" id="37296936" parent="0" x="654" y="210" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[��� ���� ����� ������� ����, �������� ��� � ������� delete �� ����������]]></content>
</node>
<node type="node/const/general_node" idtf="" shapeColor="0" id="37296792" parent="0" x="720" y="208" haveBus="false">
<content type="1" mime_type="content/term" file_name=""><![CDATA[��� ���� ����� ������� ��� ���� �������� ������ ������� ���� �� ������� ����, ����� �� �������.]]></content>
</node>
<pair type="pair/const/orient" idtf="" shapeColor="0" id="25736744" parent="0" id_b="37296936" id_e="37296792" b_x="654" b_y="210" e_x="720" e_y="208" dotBBalance="0" dotEBalance="0">
<points/>
</pair>
<pair type="pair/const/orient" idtf="" shapeColor="0" id="25736576" parent="0" id_b="37297512" id_e="37297368" b_x="171" b_y="191" e_x="285" e_y="189" dotBBalance="0" dotEBalance="0">
<points/>
</pair>
<pair type="pair/const/orient" idtf="" shapeColor="0" id="25736408" parent="0" id_b="37297368" id_e="37297224" b_x="285" b_y="189" e_x="423" e_y="194" dotBBalance="0" dotEBalance="0">
<points/>
</pair>
<pair type="pair/const/orient" idtf="" shapeColor="0" id="25736240" parent="0" id_b="37297080" id_e="37296936" b_x="548" b_y="205" e_x="654" e_y="210" dotBBalance="0" dotEBalance="0">
<points/>
</pair>
<pair type="pair/const/orient" idtf="" shapeColor="0" id="25736072" parent="0" id_b="37297224" id_e="37297080" b_x="423" b_y="194" e_x="548" e_y="205" dotBBalance="0" dotEBalance="0">
<points/>
</pair>
<arc type="arc/const/pos" idtf="" shapeColor="0" id="25735904" parent="0" id_b="37298808" id_e="25736744" b_x="395" b_y="6" e_x="0" e_y="0" dotBBalance="0" dotEBalance="0.634145">
<points/>
</arc>
<arc type="arc/const/pos" idtf="" shapeColor="0" id="25735736" parent="0" id_b="37298808" id_e="25736240" b_x="395" b_y="6" e_x="0" e_y="0" dotBBalance="0" dotEBalance="0.615707">
<points/>
</arc>
<arc type="arc/const/pos" idtf="" shapeColor="0" id="25735568" parent="0" id_b="37298808" id_e="25736576" b_x="395" b_y="6" e_x="0" e_y="0" dotBBalance="0" dotEBalance="0.430394">
<points/>
</arc>
<arc type="arc/const/pos" idtf="" shapeColor="0" id="25735400" parent="0" id_b="37298808" id_e="25736408" b_x="395" b_y="6" e_x="0" e_y="0" dotBBalance="0" dotEBalance="0.551123">
<points/>
</arc>
<arc type="arc/const/pos" idtf="" shapeColor="0" id="25735232" parent="0" id_b="37298808" id_e="25736072" b_x="395" b_y="6" e_x="0" e_y="0" dotBBalance="0" dotEBalance="0.544189">
<points/>
</arc>
</staticSector>
</GWF>
97 changes: 93 additions & 4 deletions suit/core/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ def initialize(self, log_file = 'srs_engine.log', modules = [], repo_path = 'rep
mygui.Align(),
"Popup")
self._exit_button.subscribeEventMouseButtonClick(self, "_onExitButton")

render_engine._start_rendering()


# creates explain panel
explain = Explain()
explainThread = threading.Thread(target=explain.slideExplains)
explainThread.start()

render_engine._start_rendering()


def initSCMemory(self):
"""Initialization of sc memory
Expand Down Expand Up @@ -1586,4 +1591,88 @@ def translationChanged(self):
"""
self.mainWindow._needLocalizationUpdate()
for obj in self.__overlayObjects:
obj._needLocalizationUpdate()
obj._needLocalizationUpdate()

class Explain():
def __init__(self):
import render.mygui as mygui
self.explainPanel = render_engine.Gui.createWidgetT("Window", "Panel",
mygui.IntCoord(0, 0, 200, 200), mygui.Align(),
"Info", "")
self.explains = self.getExplains()
self.curExplain = 0;
self.text = self.explainPanel.createWidgetT("StaticText",
"ToolTipText",
mygui.IntCoord(12, 12, 0, 0),
mygui.Align())

self.text.setCaption(self.explains[0])
tsize = self.text.getTextSize()
w = tsize.width + 24
h = tsize.height + 24
self.explainPanel.setSize(w + 24, h + 24)
self.text.setSize(w, h)
x = 20
y = (render_engine.Window.height - 120)
self.explainPanel.setPosition(x, y)
self.explainPanel.setAlpha(1.0)
exiteExplain = self.explainPanel.createWidgetT("Button",
"MainPanel_OutputWindowDelButton",
mygui.IntCoord(0, 5, 20, 20),
mygui.Align(),
"")
exiteExplain.subscribeEventMouseButtonClick(self, "_onExitExplain")
self.explainPanel.subscribeEventMouseDrag(self, "_eventMouseDragPanel")
self.explainPanel.subscribeEventMouseButtonPressed(self, "_eventMouseButtonPressedPanel")

def getExplains(self):
import suit.core.sc_utils as sc_utils
import sc_core.pm as sc
session = Kernel.session()
result = []
attr = sc_utils.getElementByIdtf("next*", ["/seb/test"])
el = sc_utils.getElementByIdtf("first", ["/seb/test"])
result.append(sc_utils.cp1251ToUtf8(session.get_content_str(el)))
cur = sc_utils.searchBinPairsAttrFromNode(session, el, attr, sc.SC_POS)
while cur:
el = cur[0]
result.append(sc_utils.cp1251ToUtf8(session.get_content_str(el)))
cur = sc_utils.searchBinPairsAttrFromNode(session, el, attr, sc.SC_POS)

return result

def slideExplains(self):
time.sleep(5.0)
self.explainPanel.setVisible(False)
time.sleep(2.0)
while self.curExplain < len(self.explains)-1 :
self.explainPanel.setVisible(True)
self.curExplain += 1
self.text.setCaption(self.explains[self.curExplain])
tsize = self.text.getTextSize()
w = tsize.width + 24
h = tsize.height + 24
self.explainPanel.setSize(w + 24, h + 24)
self.text.setSize(w, h)
x = 20
y = (render_engine.Window.height - 120)
self.explainPanel.setPosition(x, y)
self.explainPanel.setAlpha(1.0)
self.slideExplains()


def _eventMouseDragPanel(self, _sender, _left, _top):
dx = _left - self.x
dy = _top - self.y
pos = self.explainPanel.getPosition()
self.explainPanel.setPosition(pos.left + dx, pos.top + dy)

def _eventMouseButtonPressedPanel(self, _sender, _left, _top, _id):
"""Event on identifier pressed
"""
self.x = _left
self.y = _top

def _onExitExplain(self, widget):
render_engine.Gui.destroyWidget(self.explainPanel)