ticker_gtk
This commit is contained in:
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"python.pythonPath": "/usr/bin/python3",
|
"python.pythonPath": "/usr/bin/python3.5",
|
||||||
"python.linting.pylintEnabled": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"python.linting.pep8Enabled": false,
|
"python.linting.pep8Enabled": false,
|
||||||
"python.linting.enabled": true
|
"python.linting.enabled": true
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
|||||||
|
# You are free to use and/or change this code for
|
||||||
|
# your own needs.
|
||||||
|
|
||||||
|
# Original code (c)2018 Jan Lerking
|
||||||
|
# Program to convert C-header (*.h) files to nasm include files (*.inc),
|
||||||
|
# for direct usage in assembly programming using nasm/yasm.
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
def init():
|
||||||
|
global ticker_num
|
||||||
|
ticker_num = 1000
|
||||||
|
global home
|
||||||
|
home = str(Path.home())
|
||||||
|
global num_cores
|
||||||
|
num_cores = multiprocessing.cpu_count()
|
||||||
|
global queue
|
||||||
|
queue = 0
|
||||||
|
global fraction
|
||||||
|
fraction = 0
|
||||||
|
global worker
|
||||||
|
worker = []
|
||||||
|
global listener
|
||||||
|
listener = []
|
||||||
|
global thread
|
||||||
|
thread = []
|
||||||
|
global tupline
|
||||||
|
tupline = []
|
||||||
|
global preproc
|
||||||
|
preproc = ()
|
||||||
|
global filelist
|
||||||
|
filelist = []
|
||||||
|
global folderlist
|
||||||
|
folderlist = []
|
||||||
|
global cnt
|
||||||
|
cnt = 0
|
||||||
|
global srcdir
|
||||||
|
srcdir = ''
|
||||||
|
global destdir
|
||||||
|
destdir = ''
|
||||||
|
global fileindex
|
||||||
|
fileindex = 0
|
||||||
|
global filecnt
|
||||||
|
filecnt = 0
|
||||||
|
global incinc
|
||||||
|
incinc = ''
|
||||||
|
global defdir
|
||||||
|
defdir = False
|
||||||
|
global defsrc
|
||||||
|
defsrc = '/usr/include'
|
||||||
|
global defdest
|
||||||
|
defdest = home+'/include'
|
||||||
|
global count
|
||||||
|
count = 0
|
||||||
|
|
||||||
@@ -0,0 +1,398 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.18.3 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.12"/>
|
||||||
|
<object class="GtkApplicationWindow" id="window">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="execute_button">
|
||||||
|
<property name="label">gtk-execute</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="yalign">0.5899999737739563</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="on_execute_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="valign">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="resize_mode">immediate</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="ticker_frame">
|
||||||
|
<property name="name">Ticker</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resize_mode">immediate</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_put_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items put in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_put_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_put_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_items_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items currently in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_items_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_items_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_processed_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items processed in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_processed_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_processed_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="ticker_frame_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Ticker Queue</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="work_frame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_put_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items put in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_put_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="work_put_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_items_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items currently in Queue:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_items_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="work_items_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_processed_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items processed in Queue:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_processed_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="progressbar5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="label2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Work Queue</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.18.3 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.12"/>
|
||||||
|
<object class="GtkApplicationWindow" id="window">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="execute_button">
|
||||||
|
<property name="label">gtk-execute</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="yalign">0.5899999737739563</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="on_execute_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="valign">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="resize_mode">immediate</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="ticker_frame">
|
||||||
|
<property name="name">Ticker</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resize_mode">immediate</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_put_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items put in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_put_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_put_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_items_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items currently in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_items_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_items_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_processed_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items processed in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ticker_processed_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="ticker_processed_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="ticker_frame_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Ticker Queue</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="work_frame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_put_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items put in Queue:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_put_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="work_put_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_items_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items currently in Queue:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_items_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="work_items_progress">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_processed_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Items processed in Queue:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="work_processed_count_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkProgressBar" id="progressbar5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
<property name="width">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="label2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Work Queue</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
Executable
+281
@@ -0,0 +1,281 @@
|
|||||||
|
#!/usr/bin/env python3.5
|
||||||
|
|
||||||
|
# You are free to use and/or change this code for
|
||||||
|
# your own needs.
|
||||||
|
|
||||||
|
# Original code (c)2018 Jan Lerking
|
||||||
|
# Program to convert C-header (*.h) files to nasm include files (*.inc),
|
||||||
|
# for direct usage in assembly programming using nasm/yasm.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk, Gio, GObject as gobject
|
||||||
|
import multiprocessing
|
||||||
|
import threading
|
||||||
|
import globvar
|
||||||
|
import time
|
||||||
|
#from h2inc_mp import start_workers
|
||||||
|
#from h2inc_fp import sourcedir_filecnt, sourcedir_foldercnt
|
||||||
|
|
||||||
|
globvar.init()
|
||||||
|
|
||||||
|
|
||||||
|
gobject.threads_init()
|
||||||
|
|
||||||
|
class Listener(gobject.GObject):
|
||||||
|
__gsignals__ = {
|
||||||
|
'ticker_update' : (gobject.SIGNAL_RUN_LAST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
(gobject.TYPE_FLOAT,
|
||||||
|
gobject.TYPE_FLOAT,
|
||||||
|
gobject.TYPE_FLOAT)),
|
||||||
|
'ticker_finished' : (gobject.SIGNAL_RUN_LAST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
()),
|
||||||
|
'handlers_finished' : (gobject.SIGNAL_RUN_LAST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
()),
|
||||||
|
'workers_update' : (gobject.SIGNAL_RUN_LAST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
(gobject.TYPE_FLOAT,
|
||||||
|
gobject.TYPE_FLOAT,
|
||||||
|
gobject.TYPE_FLOAT)),
|
||||||
|
'workers_finished' : (gobject.SIGNAL_RUN_LAST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
())
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, queue):
|
||||||
|
gobject.GObject.__init__(self)
|
||||||
|
self.signal_queue = queue
|
||||||
|
|
||||||
|
def go(self):
|
||||||
|
print("Listener has started")
|
||||||
|
while True:
|
||||||
|
# Listen for results on the queue and process them accordingly
|
||||||
|
data = self.signal_queue.get()
|
||||||
|
print(data)
|
||||||
|
# Check if finished
|
||||||
|
if data[0]=="t_finished":
|
||||||
|
print("Ticker is finishing.")
|
||||||
|
self.emit("ticker_finished", data[0])
|
||||||
|
return
|
||||||
|
elif data[0]=="ticker_update":
|
||||||
|
print("Ticker is working.")
|
||||||
|
self.emit("update_ticker")
|
||||||
|
return
|
||||||
|
elif data[0]=="work_update":
|
||||||
|
print("Workers are working.")
|
||||||
|
self.emit("update_workers", data[0], data[1], data[2])
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.emit('update_ticker', data[0], data[1], data[2])
|
||||||
|
|
||||||
|
gobject.type_register(Listener)
|
||||||
|
|
||||||
|
class Worker():
|
||||||
|
def __init__(self, sq, wq, i):
|
||||||
|
self.signal_queue = sq
|
||||||
|
self.work_queue = wq
|
||||||
|
self.iterations = i
|
||||||
|
|
||||||
|
def go(self):
|
||||||
|
while True:
|
||||||
|
task = self.work_queue.get(2)
|
||||||
|
lock = multiprocessing.Lock().acquire()
|
||||||
|
tasks = self.work_queue.qsize()
|
||||||
|
lock.release()
|
||||||
|
with self.iterations.get_lock():
|
||||||
|
if task is None:
|
||||||
|
break
|
||||||
|
self.iterations.value += 1
|
||||||
|
tasks = tasks/1000
|
||||||
|
time.sleep(0.001)
|
||||||
|
self.work_queue.task_done()
|
||||||
|
self.signal_queue.put("work_update", tasks, self.iterations)
|
||||||
|
self.work_queue.task_done()
|
||||||
|
self.signal_queue.put("work_finished")
|
||||||
|
|
||||||
|
class Handler():
|
||||||
|
def __init__(self, sq, tq, wq, i):
|
||||||
|
self.signal_queue = sq
|
||||||
|
self.ticker_queue = tq
|
||||||
|
self.work_queue = wq
|
||||||
|
self.iterations = i
|
||||||
|
|
||||||
|
def go(self):
|
||||||
|
while self.ticker_queue.empty() is not True:
|
||||||
|
ticker = self.ticker_queue.get(0.1)
|
||||||
|
self.work_queue.put(ticker-1000)
|
||||||
|
time.sleep(0.01)
|
||||||
|
self.ticker_queue.task_done()
|
||||||
|
|
||||||
|
#def looprun(n):
|
||||||
|
#for i in tickers:
|
||||||
|
#ticker_queue.put(i)
|
||||||
|
|
||||||
|
#for i in range(20):
|
||||||
|
#t = threading.Thread(target = handler, args = (ticker_queue, work_queue))
|
||||||
|
#t.deamon = True
|
||||||
|
#t.start()
|
||||||
|
#threads.append(t)
|
||||||
|
|
||||||
|
#for i in range(8):
|
||||||
|
#p = multiprocessing.Process(target = worker, args = (work_queue, iterations, ))
|
||||||
|
#p.deamon = True
|
||||||
|
#p.start()
|
||||||
|
#processes.append(p)
|
||||||
|
|
||||||
|
#ticker_queue.join()
|
||||||
|
#for i in range(8):
|
||||||
|
#work_queue.put(None)
|
||||||
|
|
||||||
|
#work_queue.join()
|
||||||
|
|
||||||
|
#print("Closing down workers")
|
||||||
|
#for p in processes:
|
||||||
|
#p.join()
|
||||||
|
#print("Run:",n)
|
||||||
|
#print("Total number of iterations:", iterations.value)
|
||||||
|
#return
|
||||||
|
|
||||||
|
#for n in range(100):
|
||||||
|
#looprun(n+1)
|
||||||
|
|
||||||
|
class ticker:
|
||||||
|
|
||||||
|
global app
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
self.ticker_put_count = 0
|
||||||
|
self.ticker_current_count = 0
|
||||||
|
self.ticker_processed_count = 0
|
||||||
|
self.work_put_count = 0
|
||||||
|
self.work_current_count = 0
|
||||||
|
self.work_processed_count = 0
|
||||||
|
self.ticker_num = globvar.ticker_num
|
||||||
|
self.fraction = 0
|
||||||
|
self.process = None
|
||||||
|
self.signal_queue = multiprocessing.JoinableQueue()
|
||||||
|
self.ticker_queue = multiprocessing.JoinableQueue()
|
||||||
|
self.work_queue = multiprocessing.JoinableQueue()
|
||||||
|
self.iterations = multiprocessing.Value('i', 0)
|
||||||
|
self.tickers = range(globvar.ticker_num)
|
||||||
|
self.work_num = 0
|
||||||
|
self.processes = []
|
||||||
|
self.threads = []
|
||||||
|
self.app = Gtk.Application.new("org.ticker", Gio.ApplicationFlags(0))
|
||||||
|
self.app.connect("activate", self.on_app_activate)
|
||||||
|
self.app.connect("shutdown", self.on_app_shutdown)
|
||||||
|
app = self.app
|
||||||
|
|
||||||
|
def on_app_activate(self, app):
|
||||||
|
|
||||||
|
builder = Gtk.Builder()
|
||||||
|
builder.add_from_file("ticker.glade")
|
||||||
|
builder.connect_signals(self)
|
||||||
|
|
||||||
|
self.obj = builder.get_object
|
||||||
|
self.obj("window").set_application(app)
|
||||||
|
self.obj("window").set_wmclass("ticker","ticker")
|
||||||
|
self.obj("window").set_title("ticker - v.0.0.1")
|
||||||
|
self.obj("window").show_all()
|
||||||
|
self.obj("ticker_put_count_label").set_text(str(self.ticker_put_count))
|
||||||
|
self.obj("ticker_items_count_label").set_text(str(self.ticker_current_count))
|
||||||
|
self.obj("ticker_processed_count_label").set_text(str(self.ticker_processed_count))
|
||||||
|
self.obj("work_put_count_label").set_text(str(self.work_put_count))
|
||||||
|
self.obj("work_items_count_label").set_text(str(self.work_current_count))
|
||||||
|
self.obj("work_processed_count_label").set_text(str(self.work_processed_count))
|
||||||
|
|
||||||
|
def on_app_shutdown(self, app):
|
||||||
|
self.app.quit()
|
||||||
|
|
||||||
|
def run(self, argv):
|
||||||
|
self.app.run(argv)
|
||||||
|
|
||||||
|
def update_ticker(self, obj, index1, index2, index3, data=None):
|
||||||
|
self.val_1 = index1*self.fraction
|
||||||
|
self.val_2 = index2*self.fraction
|
||||||
|
self.val_3 = index3*self.fraction
|
||||||
|
self.obj("ticker_put_count_label").set_text(index1)
|
||||||
|
self.obj("ticker_put_progressbar").set_fraction(self.val_1)
|
||||||
|
self.obj("ticker_items_count_label").set_text(index2)
|
||||||
|
self.obj("ticker_items_progressbar").set_fraction(self.val_2)
|
||||||
|
self.obj("ticker_processed_count_label").set_text(index3)
|
||||||
|
self.obj("ticker_processed_progressbar").set_fraction(self.val_3)
|
||||||
|
|
||||||
|
def update_work(self, obj, index1, index2, index3, data=None):
|
||||||
|
self.val_1 = index1*self.fraction
|
||||||
|
self.val_2 = index2*self.fraction
|
||||||
|
self.val_3 = index3*self.fraction
|
||||||
|
self.obj("work_put_count_label").set_text(index1)
|
||||||
|
self.obj("work_put_progressbar").set_fraction(self.val_1)
|
||||||
|
self.obj("work_items_count_label").set_text(index2)
|
||||||
|
self.obj("work_items_progressbar").set_fraction(self.val_2)
|
||||||
|
self.obj("work_processed_count_label").set_text(index3)
|
||||||
|
self.obj("work_processed_progressbar").set_fraction(self.val_3)
|
||||||
|
|
||||||
|
def ticker_Finished(self, obj, data=None):
|
||||||
|
for t in range(20):
|
||||||
|
t = threading.Thread(target = Handler.go, args = (self.ticker_queue, self.work_queue))
|
||||||
|
t.deamon = True
|
||||||
|
t.start()
|
||||||
|
self.threads.append(t)
|
||||||
|
|
||||||
|
self.obj("ticker_put_count_label").set_text(self.ticker_num)
|
||||||
|
self.obj("ticker_put_progressbar").set_fraction(1.0)
|
||||||
|
self.obj("ticker_items_count_label").set_text("0")
|
||||||
|
self.obj("ticker_items_progressbar").set_fraction(0.0)
|
||||||
|
self.obj("ticker_processed_count_label").set_text(self.ticker_num)
|
||||||
|
self.obj("ticker_processed_progressbar").set_fraction(1.0)
|
||||||
|
|
||||||
|
def workers_Finished(self, obj, data=None):
|
||||||
|
if self.process==None:
|
||||||
|
raise RuntimeError("No worker process started")
|
||||||
|
print("all done; joining worker process")
|
||||||
|
self.process.join()
|
||||||
|
self.process = None
|
||||||
|
|
||||||
|
self.obj("work_put_count_label").set_text(self.work_num)
|
||||||
|
self.obj("work_put_progressbar").set_fraction(1.0)
|
||||||
|
self.obj("work_items_count_label").set_text("0")
|
||||||
|
self.obj("work_items_progressbar").set_fraction(0.0)
|
||||||
|
self.obj("work_processed_count_label").set_text(self.work_num)
|
||||||
|
self.obj("work_processed_progressbar").set_fraction(1.0)
|
||||||
|
|
||||||
|
def on_window_destroy(self,window):
|
||||||
|
window.close()
|
||||||
|
|
||||||
|
def on_execute_clicked(self,widget):
|
||||||
|
print("Creating Listener")
|
||||||
|
listener = Listener(self.signal_queue)
|
||||||
|
listener.connect("ticker_update",self.update_ticker)
|
||||||
|
listener.connect("ticker_finished",self.ticker_Finished)
|
||||||
|
listener.connect("workers_update",self.update_work)
|
||||||
|
listener.connect("workers_finished",self.workers_Finished)
|
||||||
|
|
||||||
|
print("Starting Listener")
|
||||||
|
thread = threading.Thread(target=listener.go, args=())
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
for i in self.tickers:
|
||||||
|
self.ticker_queue.put(i)
|
||||||
|
|
||||||
|
for i in range(8):
|
||||||
|
p = multiprocessing.Process(target = Worker.go, args = (self.work_queue, self.iterations, ))
|
||||||
|
p.deamon = True
|
||||||
|
p.start()
|
||||||
|
self.processes.append(p)
|
||||||
|
|
||||||
|
self.ticker_queue.join()
|
||||||
|
for i in range(8):
|
||||||
|
self.work_queue.put(None)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app = ticker()
|
||||||
|
app.run(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ def looprun(n):
|
|||||||
print("Total number of iterations:", iterations.value)
|
print("Total number of iterations:", iterations.value)
|
||||||
return
|
return
|
||||||
|
|
||||||
for n in range(1):
|
for n in range(100):
|
||||||
looprun(n)
|
looprun(n+1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user