Re: Полноценная стойка на стол плазменного раскроя на базе Е
Добавлено: 11 янв 2013, 14:20
Посмотри, что происходит на пинах:
sum2.thc.in0
sum2.thc.out
sum2.thc.in0
sum2.thc.out
Статьи, обзоры, цены на станки и комплектующие.
https://cnc-club.ru/forum/
Код: Выделить всё
addf sum2.thc servo-threadКод: Выделить всё
# загружаем sum2
loadrt sum2 names=sum2.thcКод: Выделить всё
loadrt conv_s32_float names = conv_s32_float.updown
addf conv_s32_float.updown servo-thread
net conv-in => conv_s32_float.updown.in <= updown.thc.count
net conv-out => conv_s32_float.updown.out <= sum2.thc.in0
Создаешь файл my-glade.pylobzik писал(а): Но все так же остается вопрос: как зделать, чтоб числа в полях ввода сохранялись, и при следующей загрузке не нужно было бы их вводить?
Код: Выделить всё
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
self.defaults = {
# the following names will be saved/restored as method attributes
# the save/restore mechanism is strongly typed - the variables type will be derived from the type of the
# initialization value. Currently supported types are: int, float, bool, string
IniFile.vars : { 'nhits' : 0, 'a': 1.67, 'd': True ,'c' : "a string"},
# to save/restore all widget's state which might remotely make sense, add this:
IniFile.widgets : widget_defaults(builder.get_objects())
# a sensible alternative might be to retain only all HAL output widgets' state:
# IniFile.widgets: widget_defaults(select_widgets(self.builder.get_objects(), hal_only=True,output_only = True)),
}
self.ini_filename = __name__ + '.ini'
self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
self.ini.restore_state(self)
import gtk
def on_destroy(self,obj,data=None):
self.ini.save_state(self)
В разделе HAL Python есть виджет Combobox - это как раз выпадающий список.lobzik писал(а):А вообще не плохо было бы зделать выпадающую таблицу с толщинами металла, напряжением, высотой подпрыжки, и только выбирать нужную строку, такое возможно?
Это вообще не понял как делаетсяNick писал(а):Плюс нужно какому-нибудь объекту на форме привязать сигнал destroy к функции on_destroy
Код: Выделить всё
import hal
import glib
import time
import gtk
from gladevcp.persistence import IniFile,widget_defaults,set_debug,select_widgets
import os,sys
class HandlerClass:
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
self.defaults = {
# the following names will be saved/restored as method attributes
# the save/restore mechanism is strongly typed - the variables type will be derived from the type of the
# initialization value. Currently supported types are: int, float, bool, string
IniFile.vars : { 'nhits' : 0, 'a': 1.67, 'd': True ,'c' : "a string"},
# to save/restore all widget's state which might remotely make sense, add this:
IniFile.widgets: widget_defaults(select_widgets(self.builder.get_objects(), hal_only=True,output_only = True)),
# a sensible alternative might be to retain only all HAL output widgets' state:
# IniFile.widgets: widget_defaults(select_widgets(self.builder.get_objects(), hal_only=True,output_only = True)),
}
(directory,filename) = os.path.split(__file__)
(basename,extension) = os.path.splitext(filename)
self.ini_filename = os.path.join(directory,basename + '.ini')
self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
self.ini.restore_state(self)
def on_destroy(self,obj,data=None):
self.ini.save_state(self)
def get_handlers(halcomp,builder,useropts):
'''
this function is called by gladevcp at import time (when this module is passed with '-u <modname>.py')
return a list of object instances whose methods should be connected as callback handlers
any method whose name does not begin with an underscore ('_') is a callback candidate
the 'get_handlers' name is reserved - gladevcp expects it, so do not change
'''
return [HandlerClass(halcomp,builder,useropts)]