Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Sourcery refactored master branch #3

Open
wants to merge 6 commits into
base: sourcery/master
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion gui_cvs/hello.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from cvs import *


class MyApp(App):
def __init__(self, *args):
super(MyApp, self).__init__(*args)
Expand All @@ -7,5 +9,6 @@ def main(self):
# return of the root widget
return gui.Label("Hello world!", width=100, height=30)


initcv(cvs.openwin)
startcv(MyApp)
startcv(MyApp)
36 changes: 22 additions & 14 deletions gui_cvs/table.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
from cvs import *


class MyApp(App):
def __init__(self, *args):
super(MyApp, self).__init__(*args)

def main(self):
wid = gui.VBox(width=500, height=500, style={'margin':'5px auto', 'padding': '10px'})
wid = gui.VBox(width=500,
height=500,
style={
"margin": "5px auto",
"padding": "10px"
})

lbl_description = gui.Label("""Example about TableWidget usage.
Change rows and columns count in order to see the behaviour.
After changing the size, 'Fill the table' content by means of the button.""")
Change rows and columns count in order to see the behaviour.
After changing the size, 'Fill the table' content by means of the button."""
)

wid.append(lbl_description)

table = gui.TableWidget(10, 3, True, True, width=300, height=300)
table.style['font-size'] = '8px'
table.style["font-size"] = "8px"

container = gui.HBox(width='100%')
lbl_row_count = gui.Label('Rows:')
container = gui.HBox(width="100%")
lbl_row_count = gui.Label("Rows:")
spin_row_count = gui.SpinBox(10, 0, 15)
spin_row_count.onchange.do(self.on_row_count_change, table)
container.append(lbl_row_count)
container.append(spin_row_count)
wid.append(container)

container = gui.HBox(width='100%')
lbl_column_count = gui.Label('Columns:')
container = gui.HBox(width="100%")
lbl_column_count = gui.Label("Columns:")
spin_column_count = gui.SpinBox(3, 0, 4)
spin_column_count.onchange.do(self.on_column_count_change, table)
container.append(lbl_column_count)
container.append(spin_column_count)
wid.append(container)

bt_fill_table = gui.Button('Fill table', width=100)
bt_fill_table = gui.Button("Fill table", width=100)
bt_fill_table.onclick.do(self.fill_table, table)
wid.append(bt_fill_table)

chk_use_title = gui.CheckBoxLabel('Use title', True)
chk_use_title = gui.CheckBoxLabel("Use title", True)
chk_use_title.onchange.do(self.on_use_title_change, table)
wid.append(chk_use_title)

Expand All @@ -56,17 +64,17 @@ def on_column_count_change(self, emitter, value, table):
def fill_table(self, emitter, table):
for ri in range(table.row_count()):
for ci in range(table.column_count()):
table.item_at(ri, ci).set_text("row:%s,column:%s"%(str(ri),str(ci)))
table.item_at(ri, ci).set_text("row:%s,column:%s" %
(str(ri), str(ci)))

def on_use_title_change(self, emitter, value, table):
value = value == 'true'
value = value == "true"
table.set_use_title(value)

def on_table_item_changed(self, table, item, new_value, row, column):
print("text: %s row: %s column: %s"%(new_value, row, column))
print("text: %s row: %s column: %s" % (new_value, row, column))


if __name__ == "__main__":
initcv(cvs.openwin)
startcv(MyApp)

108 changes: 73 additions & 35 deletions gui_wizard/helloworld.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,107 @@

# -*- coding: utf-8 -*-


from remi.gui import *


from cvs import *
from remi.gui import *


class untitled(App):
def __init__(self, *args, **kwargs):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
if 'editing_mode' not in kwargs.keys():
super(untitled, self).__init__(*args, static_file_path={'my_res':'./res/'})
# DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
if "editing_mode" not in kwargs.keys():
super(untitled,
self).__init__(*args, static_file_path={"my_res": "./res/"})

def idle(self):
#idle function called every update cycle
# idle function called every update cycle
pass

def main(self):
return untitled.construct_ui(self)

@staticmethod
def construct_ui(self):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
# DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
mainContainer = Widget()
mainContainer.attributes.update({"editor_baseclass":"Widget","editor_tag_type":"widget","editor_newclass":"False","editor_constructor":"()","class":"Widget","editor_varname":"mainContainer"})
mainContainer.style.update({"width":"266px","position":"absolute","top":"61px","left":"16px","margin":"0px","overflow":"auto","height":"257px"})
button = Button('Say Hello')
button.attributes.update({"editor_baseclass":"Button","editor_tag_type":"widget","editor_newclass":"False","editor_constructor":"('Say Hello')","class":"Button","editor_varname":"button"})
button.style.update({"width":"149px","position":"absolute","top":"80px","left":"37px","margin":"0px","overflow":"auto","height":"29px"})
mainContainer.append(button,'button')
label = Label('My label')
label.attributes.update({"editor_baseclass":"Label","editor_tag_type":"widget","editor_newclass":"False","editor_constructor":"('My label')","class":"Label","editor_varname":"label"})
label.style.update({"width":"98px","position":"absolute","top":"20px","left":"20px","margin":"0px","overflow":"auto","height":"25px"})
mainContainer.append(label,'label')
mainContainer.children['button'].onclick.do(self.onclick_button)

mainContainer.attributes.update({
"editor_baseclass": "Widget",
"editor_tag_type": "widget",
"editor_newclass": "False",
"editor_constructor": "()",
"class": "Widget",
"editor_varname": "mainContainer",
})
mainContainer.style.update({
"width": "266px",
"position": "absolute",
"top": "61px",
"left": "16px",
"margin": "0px",
"overflow": "auto",
"height": "257px",
})
button = Button("Say Hello")
button.attributes.update({
"editor_baseclass": "Button",
"editor_tag_type": "widget",
"editor_newclass": "False",
"editor_constructor": "('Say Hello')",
"class": "Button",
"editor_varname": "button",
})
button.style.update({
"width": "149px",
"position": "absolute",
"top": "80px",
"left": "37px",
"margin": "0px",
"overflow": "auto",
"height": "29px",
})
mainContainer.append(button, "button")
label = Label("My label")
label.attributes.update({
"editor_baseclass": "Label",
"editor_tag_type": "widget",
"editor_newclass": "False",
"editor_constructor": "('My label')",
"class": "Label",
"editor_varname": "label",
})
label.style.update({
"width": "98px",
"position": "absolute",
"top": "20px",
"left": "20px",
"margin": "0px",
"overflow": "auto",
"height": "25px",
})
mainContainer.append(label, "label")
mainContainer.children["button"].onclick.do(self.onclick_button)

self.mainContainer = mainContainer
return self.mainContainer

def onclick_button(self, emitter):
self.mainContainer.children['label'].set_text('hello world')


def onclick_button(self, emitter):
self.mainContainer.children["label"].set_text("hello world")


# processing_code

#processing_code

def process():

cap=cvs.VideoCapture(1)
cap = cvs.VideoCapture(1)

while True:
sleep(30)
img =cap.read()
img = cap.read()

if img is None :
if img is None:
continue
cvs.imshow(img)


if __name__ == "__main__":

initcv(cvs.openwin)
startcv(untitled)

46 changes: 27 additions & 19 deletions src/cvs/webcam.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@

# -*- coding: utf-8 -*-

from cvs import *


class untitled(App):
def __init__(self, *args, **kwargs):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
if 'editing_mode' not in kwargs.keys():
super(untitled, self).__init__(*args, static_file_path={'my_res':'./res/'})
# DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
if "editing_mode" not in kwargs.keys():
super(untitled,
self).__init__(*args, static_file_path={"my_res": "./res/"})

def idle(self):
#idle function called every update cycle
# idle function called every update cycle
pass

def main(self):
return untitled.construct_ui(self)

@staticmethod
def construct_ui(self):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
# DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
aidcam = OpencvVideoWidget(self)
aidcam.set_identifier("myimage_receiver")#aidcam.attributes.update({"src":"/528175722896/get_image_data","editor_newclass":"False","editor_baseclass":"OpencvVideoWidget","editor_constructor":"()","class":"OpencvVideoWidget","editor_tag_type":"widget","editor_varname":"aidcam"})
aidcam.style.update({"width":"190px","position":"absolute","top":"20px","left":"20px","margin":"0px","overflow":"auto","height":"177px"})

# aidcam.attributes.update({"src":"/528175722896/get_image_data","editor_newclass":"False","editor_baseclass":"OpencvVideoWidget","editor_constructor":"()","class":"OpencvVideoWidget","editor_tag_type":"widget","editor_varname":"aidcam"})
aidcam.set_identifier("myimage_receiver")
aidcam.style.update({
"width": "190px",
"position": "absolute",
"top": "20px",
"left": "20px",
"margin": "0px",
"overflow": "auto",
"height": "177px",
})

self.aidcam = aidcam
return self.aidcam


#processing_code

# processing_code


def process():

cap=cvs.VideoCapture(1)
cap = cvs.VideoCapture(1)

while True:
sleep(30)
img =cap.read()
img = cap.read()

if img is None :
if img is None:
continue
cvs.imshow(img)


if __name__ == "__main__":

initcv(process)
startcv(untitled)

Loading