def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/cropImage.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "BackgroundColor", "BorderColor", "HelpView"] handlers = [ "on_cancel_clicked", "on_prop_confirm_clicked", "on_BackColorButton_clicked", "on_BorderColorButton_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.configure() # load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/cropImage" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets["HelpView"].set_buffer(t_oTextBuffer)
def __init__( self ): """ Sets the Glade file where the about window is defined and Connects the signals and its handlers through GladeWindow __init__ """ ## Get the file with the about window self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/about.ui' ## The widget list widget_list = [ 'about', 'harpia_name', 'about_s2i_logo', 'about_finep_logo' ] handlers = [ ] # The top three widget top_window = 'about' # Starts the Glade Window GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # Set the Icons and logos self.widgets['about'].set_icon_from_file(self.m_sDataDir+"images/harpia_ave.png") self.widgets['harpia_name'].set_from_file(self.m_sDataDir+"images/harpia_name.png") self.widgets['about_s2i_logo'].set_from_file(self.m_sDataDir+"images/s2ilogo.png") self.widgets['about_finep_logo'].set_from_file(self.m_sDataDir+"images/finep_logo.gif")
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/canny.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'CANNThreshold1', 'CANNThreshold2', 'CANNApertureSize', 'BackgroundColor', 'BorderColor', 'HelpView', 'canny_confirm' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_canny_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "threshold1": self.widgets['CANNThreshold1'].set_value( float(Property.value) ) if Property.name == "threshold2": self.widgets['CANNThreshold2'].set_value( float(Property.value) ) if Property.name == "apertureSize": # if Property.value == "1": # self.widgets['CANNApertureSize'].set_active( int(0) ) if Property.value == "3": self.widgets['CANNApertureSize'].set_active( int(0) ) if Property.value == "5": self.widgets['CANNApertureSize'].set_active( int(1) ) if Property.value == "7": self.widgets['CANNApertureSize'].set_active( int(2) ) self.configure() #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+"help/canny"+ _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/show.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SHOWDisable', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values # There is no properties # load block state t_bState = self.m_oS2iBlockProperties.GetState() self.widgets['SHOWDisable'].set_active(not t_bState) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/isOnRect.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values # for Property in self.m_oPropertiesXML.properties.block.property: # if Property.name == "angle": # self.widgets['angle'].set_value( float(Property.value) ); self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/not.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_cancel_clicked', 'on_not_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/pow.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'POWExponent', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_cancel_clicked', 'on_pow_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "exponent": self.widgets['POWExponent'].set_value(int(Property.value)) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/liveDelay.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "frameNumber", "BackgroundColor", "BorderColor", "HelpView", "prop_confirm"] handlers = [ "on_cancel_clicked", "on_prop_confirm_clicked", "on_BackColorButton_clicked", "on_BorderColorButton_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "frameNumber": self.widgets["frameNumber"].set_value(int(float(value))) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/equalizeHistogram.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "BackgroundColor", "BorderColor", "HelpView"] handlers = [ # 'on_EQUARadioAutomatic_pressed', # 'on_EQUARadioBand_pressed', "on_BackColorButton_clicked", "on_BorderColorButton_clicked", "on_cancel_clicked", "on_equalizeHistogram_confirm_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + "help/equalizeHistogram" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets["HelpView"].set_buffer(t_oTextBuffer)
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/cropImage.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'propBackgroundColor', 'propBorderColor', 'propHelpView' ] handlers = [ 'on_prop_cancel_clicked', 'on_prop_confirm_clicked', 'on_propBackColorButton_clicked', 'on_propBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir+"images/harpia_ave.png") #load properties values #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed,green=t_nBorderGreen,blue=t_nBorderBlue) self.widgets['propBorderColor'].modify_bg(gtk.STATE_NORMAL,t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed,green=t_nBackGreen,blue=t_nBackBlue) self.widgets['propBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+'help/cropImage'+ _('_en.help')) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['propHelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/rotate.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'isAtCenter', 'isAtPoint', 'isScalling', 'isFilling', 'xC', 'yC', 'BackgroundColor', 'BorderColor', 'HelpView', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "xC": self.widgets['xC'].set_value(float(Property.value)); if Property.name == "yC": self.widgets['yC'].set_value(float(Property.value)); if Property.name == "isFilling": if Property.value == "true": self.widgets['isFilling'].set_active(True); else: self.widgets['isFilling'].set_active(False); if Property.name == "isScalling": if Property.value == "true": self.widgets['isScalling'].set_active(True); else: self.widgets['isScalling'].set_active(False); if Property.name == "isCenter": if Property.value == "true": self.widgets['isAtCenter'].set_active(True); else: self.widgets['isAtPoint'].set_active(True); self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/division.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_division_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + "help/division" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets['HelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/runCmd.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "cmdString", "BackgroundColor", "BorderColor", "HelpView", "enIsntZero"] handlers = [ "on_cancel_clicked", "on_prop_confirm_clicked", "on_BackColorButton_clicked", "on_BorderColorButton_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "cmdString": self.widgets["cmdString"].set_text(Property.value) if Property.name == "enIsntZero": self.widgets["enIsntZero"].set_active(Property.value == "True") self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/sobel.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SOBEXOrder', 'SOBEYOrder', 'SOBEMaskSize', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_sobel_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.OrderLimit = 6 # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "xorder": self.widgets['SOBEXOrder'].set_value(int(Property.value)) if Property.name == "yorder": self.widgets['SOBEYOrder'].set_value(int(Property.value)) if Property.name == "masksize": if Property.value == "1": self.widgets['SOBEMaskSize'].set_active(int(0)) if Property.value == "3": self.widgets['SOBEMaskSize'].set_active(int(1)) if Property.value == "5": self.widgets['SOBEMaskSize'].set_active(int(2)) if Property.value == "7": self.widgets['SOBEMaskSize'].set_active(int(3)) self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + "help/sobel" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets['HelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/comment.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "BackgroundColor", "BorderColor", "HelpView", "COMMENTView"] handlers = [ "on_BackColorButton_clicked", "on_BorderColorButton_clicked", "on_cancel_clicked", "on_comment_confirm_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: # self.widgets['FILLBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oColor) name = Property.getAttr("name") value = Property.getAttr("value") if name == "comment": self.m_sComment = str(value) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/equalizeHistogram.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ # 'on_EQUARadioAutomatic_pressed', # 'on_EQUARadioBand_pressed', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_equalizeHistogram_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/findSquares.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView', 'minVal', 'maxVal', 'enMin', 'enMax', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_enMin_toggled', 'on_enMax_toggled' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "minVal": self.widgets['minVal'].set_value(int(float(value))) if name == "maxVal": self.widgets['maxVal'].set_value(int(float(value))) if name == "enMin": self.widgets['enMin'].set_active(value == 'True') if name == "enMax": self.widgets['enMax'].set_active(value == 'True') self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + 'help/findSquares' + _('_en.help')) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets['HelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/threshold.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'THREThreshold', 'THREThresholdType', 'THRELabelMaxValue', 'THREMaxValue', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_THREThresholdType_changed', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_threshold_confirm_clicked', ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "threshold": self.widgets['THREThreshold'].set_value(float(Property.value)) if Property.name == "maxValue": self.widgets['THREMaxValue'].set_value(float(Property.value)) if Property.name == "thresholdType": if Property.value == "CV_THRESH_BINARY": self.widgets['THREThresholdType'].set_active(int(0)) self.on_THREThresholdType_changed() if Property.value == "CV_THRESH_BINARY_INV": self.widgets['THREThresholdType'].set_active(int(1)) self.on_THREThresholdType_changed() if Property.value == "CV_THRESH_TRUNC": self.widgets['THREThresholdType'].set_active(int(2)) self.on_THREThresholdType_changed() if Property.value == "CV_THRESH_TOZERO": self.widgets['THREThresholdType'].set_active(int(3)) self.on_THREThresholdType_changed() if Property.value == "CV_THRESH_TOZERO_INV": self.widgets['THREThresholdType'].set_active(int(4)) self.on_THREThresholdType_changed() self.configure()
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/smooth.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SMOOType', 'SMOOParam1', 'SMOOParam2', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_cancel_clicked', 'on_smooth_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "type": if Property.value == "CV_BLUR": self.widgets['SMOOType'].set_active( int(0) ) if Property.value == "CV_GAUSSIAN": self.widgets['SMOOType'].set_active( int(1) ) if Property.value == "CV_MEDIAN": self.widgets['SMOOType'].set_active( int(2) ) # if Property.value == "CV_BILATERAL": # self.widgets['SMOOType'].set_active( int(4) ) if Property.name == "param1": self.widgets['SMOOParam1'].set_value( int(Property.value) ) if Property.name == "param2": self.widgets['SMOOParam2'].set_value( int(Property.value) ) self.configure() #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+"help/smooth"+ _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer )
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/comment.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView', 'COMMENTView' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_comment_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) #load properties values for Property in self.m_oPropertiesXML.properties.block.property: #self.widgets['FILLBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oColor) if Property.name == "comment": self.m_sComment = str(Property.value) #print self.m_sComment self.configure() #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+"help/comment"+ _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer ) # Comment View t_sComment = gtk.TextBuffer() t_sComment.set_text(self.m_sComment) self.widgets['COMMENTView'].set_buffer(t_sComment) self.widgets['COMMENTView'].set_property('editable', True) self.widgets['COMMENTView'].set_cursor_visible(True)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/erode.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'ERODMaskSize', 'ERODIterations', 'BackgroundColor', 'BorderColor', 'HelpView', 'erode_confirm' ] handlers = [ 'on_cancel_clicked', 'on_erode_confirm_clicked', 'on_BorderColorButton_clicked', 'on_BackColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") # load properties values for Property in self.block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "masksize": if value == "3x3": self.widgets['ERODMaskSize'].set_active(int(0)) if value == "5x5": self.widgets['ERODMaskSize'].set_active(int(1)) if value == "7x7": self.widgets['ERODMaskSize'].set_active(int(2)) if name == "iterations": self.widgets['ERODIterations'].set_value(int(value)) self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + "help/erode" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets['HelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/not.glade" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = ["Properties", "NOTBackgroundColor", "NOTBorderColor", "NOTHelpView"] handlers = [ "on_not_cancel_clicked", "on_not_confirm_clicked", "on_NOTBackColorButton_clicked", "on_NOTBorderColorButton_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets["Properties"].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") # load properties values # there is no properties # load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets["NOTBorderColor"].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) # load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets["NOTBackgroundColor"].modify_bg(gtk.STATE_NORMAL, t_oBackColor) # load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/not" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets["NOTHelpView"].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/plotHistogram.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'HISTImageType', 'HISTLabelChannel', 'HISTRadioR', 'HISTRadioG', 'HISTRadioB', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ # 'on_HISTRadioR_pressed', # 'on_HISTRadioG_pressed', # 'on_HISTRadioB_pressed', 'on_HISTImageType_changed', 'on_cancel_clicked', 'on_histogram_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "type": if Property.value == "allcolors": self.widgets['HISTImageType'].set_active(int(0)) if Property.value == "color": self.widgets['HISTImageType'].set_active(int(1)) self.on_HISTImageType_changed() if Property.name == "channel": if Property.value == "R": self.widgets['HISTRadioR'].set_active(True); if Property.value == "G": self.widgets['HISTRadioG'].set_active(True); if Property.value == "B": self.widgets['HISTRadioB'].set_active(True); self.configure()
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/haarDetect.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'ACQULabelFilename', 'ACQUFilename', 'min_neighbors', 'ACQUButtonSearch', 'BackgroundColor', 'BorderColor', 'HelpView', 'acquisition_confirm' ] handlers = [ 'on_ACQUButtonSearch_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_acquisition_confirm_clicked', 'on_cancel_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.m_sCurrentActive = 'file' #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "cascade_name": self.widgets['ACQUFilename'].set_text( Property.value ); if Property.name == "min_neighbors": self.widgets['min_neighbors'].set_value( int(float(Property.value)) ); #load block state t_bState = self.m_oS2iBlockProperties.GetState() self.configure() #load help text #t_oS2iHelp = bt.bind_file("../etc/acquisition/acquisition.help") t_oS2iHelp = bt.bind_file(self.m_sDataDir+"help/haarDetect"+ _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/smooth.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SMOOType', 'SMOOParam1', 'SMOOParam2', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_cancel_clicked', 'on_smooth_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "type": if value == "CV_BLUR": self.widgets['SMOOType'].set_active(int(0)) if value == "CV_GAUSSIAN": self.widgets['SMOOType'].set_active(int(1)) if value == "CV_MEDIAN": self.widgets['SMOOType'].set_active(int(2)) # if Property.value == "CV_BILATERAL": # self.widgets['SMOOType'].set_active( int(4) ) if name == "param1": self.widgets['SMOOParam1'].set_value(int(value)) if name == "param2": self.widgets['SMOOParam2'].set_value(int(value)) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/canny.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'CANNThreshold1', 'CANNThreshold2', 'CANNApertureSize', 'BackgroundColor', 'BorderColor', 'HelpView', 'canny_confirm' ] handlers = [ 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_canny_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") # load properties values for Property in block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "threshold1": self.widgets['CANNThreshold1'].set_value(float(value)) if name == "threshold2": self.widgets['CANNThreshold2'].set_value(float(value)) if name == "apertureSize": # if Property.value == "1": # self.widgets['CANNApertureSize'].set_active( int(0) ) if value == "3": self.widgets['CANNApertureSize'].set_active(int(0)) if value == "5": self.widgets['CANNApertureSize'].set_active(int(1)) if value == "7": self.widgets['CANNApertureSize'].set_active(int(2)) self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ["HARPIA_DATA_DIR"] filename = self.m_sDataDir + "glade/dilate.ui" self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ "Properties", "DILAMaskSize", "DILAIterations", "BackgroundColor", "BorderColor", "HelpView", "dilate_confirm", ] handlers = [ "on_BackColorButton_clicked", "on_BorderColorButton_clicked", "on_cancel_clicked", "on_dilate_confirm_clicked", ] top_window = "Properties" GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "masksize": if Property.value == "3x3": self.widgets["DILAMaskSize"].set_active(int(0)) if Property.value == "5x5": self.widgets["DILAMaskSize"].set_active(int(1)) if Property.value == "7x7": self.widgets["DILAMaskSize"].set_active(int(2)) if Property.name == "iterations": self.widgets["DILAIterations"].set_value(int(Property.value)) self.configure() # load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/dilate" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets["HelpView"].set_buffer(t_oTextBuffer)
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/findSquares.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'BackgroundColor', 'BorderColor', 'HelpView', 'minVal', 'maxVal', 'enMin', 'enMax', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_enMin_toggled', 'on_enMax_toggled' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "minVal": self.widgets['minVal'].set_value( int(float(Property.value)) ); if Property.name == "maxVal": self.widgets['maxVal'].set_value( int(float(Property.value)) ); if Property.name == "enMin": self.widgets['enMin'].set_active( Property.value == 'True' ); if Property.name == "enMax": self.widgets['enMax'].set_active( Property.value == 'True' ); self.configure() #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+'help/findSquares'+ _('_en.help')) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer )
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/newRect.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'x0', 'y0', 'width', 'height', 'BackgroundColor', 'BorderColor', 'HelpView', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "x0": self.widgets['x0'].set_value( float(Property.value) ); if Property.name == "y0": self.widgets['y0'].set_value( float(Property.value) ); if Property.name == "width": self.widgets['width'].set_value( float(Property.value) ); if Property.name == "height": self.widgets['height'].set_value( float(Property.value) ); self.configure() #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+'help/newRect'+ _('_en.help')) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['HelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/save.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SAVEFilename', 'SAVEType', 'BackgroundColor', 'BorderColor', 'HelpView' ] handlers = [ 'on_SAVEButtonSearch_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_cancel_clicked', 'on_save_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: if Property.name == "filename": self.widgets['SAVEFilename'].set_text(Property.value); # if Property.name == "filetype": # if Property.value == "png": # self.widgets['SAVEType'].set_active( int(0) ) # if Property.value == "jpeg": # self.widgets['SAVEType'].set_active( int(1) ) self.configure() # load help text t_oS2iHelp = XMLParser(self.m_sDataDir + "help/save" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.getTag("help").getTag("content").getTagContent()))) self.widgets['HelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/save.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'SAVEFilename', 'SAVEType', 'SAVEBackgroundColor', 'SAVEBorderColor', 'SAVEHelpView' ] handlers = [ 'on_SAVEButtonSearch_clicked', 'on_SAVEBackColorButton_clicked', 'on_SAVEBorderColorButton_clicked', 'on_save_cancel_clicked', 'on_save_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "filename": self.widgets['SAVEFilename'].set_text(Property.value) # if Property.name == "filetype": # if Property.value == "png": # self.widgets['SAVEType'].set_active( int(0) ) # if Property.value == "jpeg": # self.widgets['SAVEType'].set_active( int(1) ) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['SAVEBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['SAVEBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/save" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['SAVEHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/dilate.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'DILAMaskSize', 'DILAIterations', 'DILABackgroundColor', 'DILABorderColor', 'DILAHelpView', 'dilate_confirm' ] handlers = [ 'on_DILABackColorButton_clicked', 'on_DILABorderColorButton_clicked', 'on_dilate_cancel_clicked', 'on_dilate_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "masksize": if Property.value == "3x3": self.widgets['DILAMaskSize'].set_active(int(0)) if Property.value == "5x5": self.widgets['DILAMaskSize'].set_active(int(1)) if Property.value == "7x7": self.widgets['DILAMaskSize'].set_active(int(2)) if Property.name == "iterations": self.widgets['DILAIterations'].set_value(int(Property.value)) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['DILABorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['DILABackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/dilate" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['DILAHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/acquisition.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'ACQURadioFile', 'ACQURadioNewImage', 'ACQURadioCapture', 'ACQURadioLive', 'ACQURadioVideo', 'ACQULabelFileProperty', 'ACQULabelFilename', 'ACQUFilename', 'video_name', 'video_name_BT', 'video_name_LABEL', 'video_name_LABEL2', 'ACQUButtonSearch', 'ACQULabelNewImage', 'ACQULabelImageSize', 'ACQULabelWidth', 'ACQULabelHeight', 'ACQUWidth', 'ACQUHeight', 'ACQULabelCameraProperty', 'ACQULabelCamera', 'ACQUCamera', 'ACQULabelSize', 'ACQUSize', 'ACQUBackgroundColor', 'ACQUBorderColor', 'ACQUHelpView', 'frameRate_Label', 'frameRate', 'streamProperties_label', 'frameRate_label2', 'acquisition_confirm' ] handlers = [ 'on_ACQURadioFile_pressed', 'on_ACQURadioNewImage_pressed', 'on_ACQURadioCapture_pressed', 'on_ACQURadioLive_pressed', 'on_ACQUButtonSearch_clicked', 'on_ACQUVideoSearch_clicked', 'on_ACQUBackColorButton_clicked', 'on_ACQUBorderColorButton_clicked', 'on_ACQURadioVideo_pressed', 'on_acquisition_confirm_clicked', 'on_acquisition_cancel_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") self.m_nNumAvailableCams = 4 if os.name == 'posix': self.m_nNumAvailableCams = 0 t_lListVidDevs = glob("/dev/video*") self.m_nNumAvailableCams = len(t_lListVidDevs) self.widgets['ACQUCamera'].remove_text(0) for cam in range(self.m_nNumAvailableCams): self.widgets['ACQUCamera'].append_text(str("/dev/video" + str(cam))) self.widgets['ACQUCamera'].append_text(str("Default")) self.m_sCurrentActive = 'file' #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "type": if Property.value == "file": self.widgets['ACQURadioFile'].set_active(True) self.on_ACQURadioFile_pressed() elif Property.value == "camera": self.widgets['ACQURadioCapture'].set_active(True) self.on_ACQURadioCapture_pressed() self.m_sCurrentActive = 'camera' elif Property.value == "live": self.widgets['ACQURadioLive'].set_active(True) self.on_ACQURadioLive_pressed() self.m_sCurrentActive = 'live' elif Property.value == "video": self.widgets['ACQURadioVideo'].set_active(True) self.on_ACQURadioVideo_pressed() self.m_sCurrentActive = 'video' else: self.widgets['ACQURadioNewImage'].set_active(True) self.on_ACQURadioNewImage_pressed() self.m_sCurrentActive = 'newimage' if Property.name == "filename": self.widgets['ACQUFilename'].set_text(Property.value) if Property.name == "video_name": self.widgets['video_name'].set_text(Property.value) if Property.name == "camera" or Property.name == 'live': if os.name == 'posix': if int(Property.value) < self.m_nNumAvailableCams: self.widgets['ACQUCamera'].set_active( int(Property.value)) else: self.widgets['ACQUCamera'].set_active( self.m_nNumAvailableCams) #will set None if Property.name == "frameRate": self.widgets['frameRate'].set_value(float(Property.value)) # Use the property size to set the New Image size too. if Property.name == "size": if Property.value == "1024x768": self.widgets['ACQUSize'].set_active(0) if Property.value == "800x600": self.widgets['ACQUSize'].set_active(1) if Property.value == "832x624": self.widgets['ACQUSize'].set_active(2) if Property.value == "640x480": self.widgets['ACQUSize'].set_active(3) else: self.widgets['ACQUSize'].set_active(0) # New Image size self.widgets['ACQUWidth'].set_value( float(Property.value[:Property.value.find('x')])) self.widgets['ACQUHeight'].set_value( float(Property.value[Property.value.find('x') + 1:])) #load block state #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['ACQUBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['ACQUBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text #t_oS2iHelp = bt.bind_file("../etc/acquisition/acquisition.help") t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/acquisition" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['ACQUHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/colorConversion.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'COLOConversionType', 'COLOBackgroundColor', 'COLOBorderColor', 'COLOHelpView' ] handlers = [ 'on_COLOBackColorButton_clicked', 'on_COLOBorderColorButton_clicked', 'on_colorConversion_cancel_clicked', 'on_colorConversion_confirm_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "type": if Property.value == "RGB -> GRAY": self.widgets['COLOConversionType'].set_active(int(0)) if Property.value == "RGB -> YCrCb": self.widgets['COLOConversionType'].set_active(int(1)) if Property.value == "YCrCb -> RGB": self.widgets['COLOConversionType'].set_active(int(2)) if Property.value == "RGB -> HSV": self.widgets['COLOConversionType'].set_active(int(3)) if Property.value == "HSV -> RGB": self.widgets['COLOConversionType'].set_active(int(4)) if Property.value == "RGB -> HLS": self.widgets['COLOConversionType'].set_active(int(5)) if Property.value == "HLS -> RGB": self.widgets['COLOConversionType'].set_active(int(6)) if Property.value == "RGB -> CIE.XYZ": self.widgets['COLOConversionType'].set_active(int(7)) if Property.value == "CIE.XYZ -> RGB": self.widgets['COLOConversionType'].set_active(int(8)) if Property.value == "RGB -> CIE.LAB": self.widgets['COLOConversionType'].set_active(int(9)) if Property.value == "CIE.LAB -> RGB": self.widgets['COLOConversionType'].set_active(int(10)) if Property.value == "RGB -> CIE.LUV": self.widgets['COLOConversionType'].set_active(int(11)) if Property.value == "CIE.LUV -> RGB": self.widgets['COLOConversionType'].set_active(int(12)) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['COLOBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['COLOBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/colorConversion" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['COLOHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/not.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'NOTBackgroundColor', 'NOTBorderColor', 'NOTHelpView' ] handlers = [ 'on_not_cancel_clicked', 'on_not_confirm_clicked', 'on_NOTBackColorButton_clicked', 'on_NOTBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values #there is no properties #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['NOTBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['NOTBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/not" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['NOTHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/plotHistogram.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'HISTImageType', 'HISTLabelChannel', 'HISTRadioR', 'HISTRadioG', 'HISTRadioB', 'HISTBackgroundColor', 'HISTBorderColor', 'HISTHelpView' ] handlers = [ #'on_HISTRadioR_pressed', #'on_HISTRadioG_pressed', #'on_HISTRadioB_pressed', 'on_HISTImageType_changed', 'on_histogram_cancel_clicked', 'on_histogram_confirm_clicked', 'on_HISTBackColorButton_clicked', 'on_HISTBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "type": if Property.value == "allcolors": self.widgets['HISTImageType'].set_active(int(0)) if Property.value == "color": self.widgets['HISTImageType'].set_active(int(1)) self.on_HISTImageType_changed() if Property.name == "channel": if Property.value == "R": self.widgets['HISTRadioR'].set_active(True) if Property.value == "G": self.widgets['HISTRadioG'].set_active(True) if Property.value == "B": self.widgets['HISTRadioB'].set_active(True) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['HISTBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['HISTBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/plotHistogram" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['HISTHelpView'].set_buffer(t_oTextBuffer)
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/newDouble.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'doubleVal', 'propBackgroundColor', 'propBorderColor', 'propHelpView', 'prop_confirm' ] handlers = [ 'on_prop_cancel_clicked', 'on_prop_confirm_clicked', 'on_propBackColorButton_clicked', 'on_propBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir+"images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "doubleVal": self.widgets['doubleVal'].set_value( float(Property.value) ); #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed,green=t_nBorderGreen,blue=t_nBorderBlue) self.widgets['propBorderColor'].modify_bg(gtk.STATE_NORMAL,t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed,green=t_nBackGreen,blue=t_nBackBlue) self.widgets['propBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+'help/newDouble'+ _('_en.help')) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['propHelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/rotate.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'isAtCenter', 'isAtPoint', 'isScalling', 'isFilling', 'xC', 'yC', 'propBackgroundColor', 'propBorderColor', 'propHelpView', 'prop_confirm' ] handlers = [ 'on_prop_cancel_clicked', 'on_prop_confirm_clicked', 'on_propBackColorButton_clicked', 'on_propBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "xC": self.widgets['xC'].set_value(float(Property.value)) if Property.name == "yC": self.widgets['yC'].set_value(float(Property.value)) if Property.name == "isFilling": if Property.value == "true": self.widgets['isFilling'].set_active(True) else: self.widgets['isFilling'].set_active(False) if Property.name == "isScalling": if Property.value == "true": self.widgets['isScalling'].set_active(True) else: self.widgets['isScalling'].set_active(False) if Property.name == "isCenter": if Property.value == "true": self.widgets['isAtCenter'].set_active(True) else: self.widgets['isAtPoint'].set_active(True) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['propBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed, green=t_nBackGreen, blue=t_nBackBlue) self.widgets['propBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/rotate" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['propHelpView'].set_buffer(t_oTextBuffer)
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/checkCir.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'dpSel', 'distSel', 'threshSel', 'qualySel', 'minX', 'maxX', 'minY', 'maxY', 'minRad', 'maxRad', 'numOfCircs', 'PosCirc', 'NumCirc', 'BackgroundColor', 'BorderColor', 'HelpView', 'prop_confirm' ] handlers = [ 'on_cancel_clicked', 'on_prop_confirm_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) # load properties values self.block_properties = self.m_oPropertiesXML.getTag("properties").getTag("block").getChildTags("property") for Property in self.block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "dpSel": self.widgets['dpSel'].set_value(float(value)); if name == "distSel": self.widgets['distSel'].set_value(float(value)); if name == "threshSel": self.widgets['threshSel'].set_value(float(value)); if name == "qualySel": self.widgets['qualySel'].set_value(float(value)); if name == "minX": self.widgets['minX'].set_value(float(value)); if name == "maxX": self.widgets['maxX'].set_value(float(value)); if name == "minY": self.widgets['minY'].set_value(float(value)); if name == "maxY": self.widgets['maxY'].set_value(float(value)); if name == "minRad": self.widgets['minRad'].set_value(float(value)); if name == "maxRad": self.widgets['maxRad'].set_value(float(value)); if name == "numOfCircs": self.widgets['numOfCircs'].set_value(float(value)); if name == "criteria": if value == "pos": self.widgets['PosCirc'].set_active(True); elif value == "num": self.widgets['NumCirc'].set_active(True); self.configure()
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/fill.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'FILLBackgroundColor', 'FILLBorderColor', 'FILLHelpView', 'FILLFillColor' ] handlers = [ 'on_FILLBackColorButton_clicked', 'on_FILLBorderColorButton_clicked', 'on_FILLFillColorButton_clicked', 'on_fill_cancel_clicked', 'on_fill_confirm_clicked' ] top_window = 'Properties' self.m_oFillColor = [0, 0, 0] GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir + "images/harpia_ave.png") #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() #load properties values for Property in self.m_oPropertiesXML.properties.block.property: #self.widgets['FILLBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oColor) if Property.name == "red": self.m_oBackColor[0] = float(Property.value) #self.widgets['FILLFillColor'].set_value( float(Property.value) ) self.m_oFillColor[0] = float(Property.value) if Property.name == "green": self.m_oBackColor[1] = float(Property.value) self.m_oFillColor[1] = float(Property.value) if Property.name == "blue": self.m_oBackColor[2] = float(Property.value) self.m_oFillColor[2] = float(Property.value) #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed, green=t_nBorderGreen, blue=t_nBorderBlue) self.widgets['FILLBorderColor'].modify_bg(gtk.STATE_NORMAL, t_oBorderColor) #load block color #self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=int(t_nBackRed), green=int(t_nBackGreen), blue=int(t_nBackBlue)) self.widgets['FILLBackgroundColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) ######################### # Sets the Fill Color the same as the background color in inicialization self.widgets['FILLFillColor'].modify_bg(gtk.STATE_NORMAL, t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir + "help/fill" + _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text(unicode(str(t_oS2iHelp.help.content))) self.widgets['FILLHelpView'].set_buffer(t_oTextBuffer)
def __init__( self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir+'glade/checkCir.glade' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'dpSel', 'distSel', 'threshSel', 'qualySel', 'minX', 'maxX', 'minY', 'maxY', 'minRad', 'maxRad', 'numOfCircs', 'PosCirc', 'NumCirc', 'propBackgroundColor', 'propBorderColor', 'propHelpView', 'prop_confirm' ] handlers = [ 'on_prop_cancel_clicked', 'on_prop_confirm_clicked', 'on_propBackColorButton_clicked', 'on_propBorderColorButton_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.widgets['Properties'].set_icon_from_file(self.m_sDataDir+"images/harpia_ave.png") #load properties values for Property in self.m_oPropertiesXML.properties.block.property: if Property.name == "dpSel": self.widgets['dpSel'].set_value( float(Property.value) ); if Property.name == "distSel": self.widgets['distSel'].set_value( float(Property.value) ); if Property.name == "threshSel": self.widgets['threshSel'].set_value( float(Property.value) ); if Property.name == "qualySel": self.widgets['qualySel'].set_value( float(Property.value) ); if Property.name == "minX": self.widgets['minX'].set_value( float(Property.value) ); if Property.name == "maxX": self.widgets['maxX'].set_value( float(Property.value) ); if Property.name == "minY": self.widgets['minY'].set_value( float(Property.value) ); if Property.name == "maxY": self.widgets['maxY'].set_value( float(Property.value) ); if Property.name == "minRad": self.widgets['minRad'].set_value( float(Property.value) ); if Property.name == "maxRad": self.widgets['maxRad'].set_value( float(Property.value) ); if Property.name == "numOfCircs": self.widgets['numOfCircs'].set_value( float(Property.value) ); if Property.name == "criteria": if Property.value == "pos": self.widgets['PosCirc'].set_active( True ); elif Property.value == "num": self.widgets['NumCirc'].set_active( True ); #load border color self.m_oBorderColor = self.m_oS2iBlockProperties.GetBorderColor() t_nBorderRed = self.m_oBorderColor[0] * 257 t_nBorderGreen = self.m_oBorderColor[1] * 257 t_nBorderBlue = self.m_oBorderColor[2] * 257 t_oBorderColor = gtk.gdk.Color(red=t_nBorderRed,green=t_nBorderGreen,blue=t_nBorderBlue) self.widgets['propBorderColor'].modify_bg(gtk.STATE_NORMAL,t_oBorderColor) #load block color self.m_oBackColor = self.m_oS2iBlockProperties.GetBackColor() t_nBackRed = self.m_oBackColor[0] * 257 t_nBackGreen = self.m_oBackColor[1] * 257 t_nBackBlue = self.m_oBackColor[2] * 257 t_oBackColor = gtk.gdk.Color(red=t_nBackRed,green=t_nBackGreen,blue=t_nBackBlue) self.widgets['propBackgroundColor'].modify_bg(gtk.STATE_NORMAL,t_oBackColor) #load help text t_oS2iHelp = bt.bind_file(self.m_sDataDir+"help/checkCir"+ _("_en.help")) t_oTextBuffer = gtk.TextBuffer() t_oTextBuffer.set_text( unicode( str( t_oS2iHelp.help.content) ) ) self.widgets['propHelpView'].set_buffer( t_oTextBuffer )
def __init__(self, PropertiesXML, S2iBlockProperties): self.m_sDataDir = os.environ['HARPIA_DATA_DIR'] filename = self.m_sDataDir + 'glade/acquisition.ui' self.m_oPropertiesXML = PropertiesXML self.m_oS2iBlockProperties = S2iBlockProperties widget_list = [ 'Properties', 'ACQURadioFile', 'ACQURadioNewImage', 'ACQURadioCapture', 'ACQURadioLive', 'ACQURadioVideo', 'ACQULabelFileProperty', 'ACQULabelFilename', 'ACQUFilename', 'video_name', 'video_name_BT', 'video_name_LABEL', 'video_name_LABEL2', 'ACQUButtonSearch', 'ACQULabelNewImage', 'ACQULabelImageSize', 'ACQULabelWidth', 'ACQULabelHeight', 'ACQUWidth', 'ACQUHeight', 'ACQULabelCameraProperty', 'ACQULabelCamera', 'ACQUCamera', 'ACQULabelSize', 'ACQUSize', 'BackgroundColor', 'BorderColor', 'HelpView', 'frameRate_Label', 'frameRate', 'streamProperties_label', 'frameRate_label2', 'acquisition_confirm' ] handlers = [ 'on_ACQURadioFile_pressed', 'on_ACQURadioNewImage_pressed', 'on_ACQURadioCapture_pressed', 'on_ACQURadioLive_pressed', 'on_ACQUButtonSearch_clicked', 'on_ACQUVideoSearch_clicked', 'on_BackColorButton_clicked', 'on_BorderColorButton_clicked', 'on_ACQURadioVideo_pressed', 'on_acquisition_confirm_clicked', 'on_cancel_clicked' ] top_window = 'Properties' GladeWindow.__init__(self, filename, top_window, widget_list, handlers) self.m_nNumAvailableCams = 4 if os.name == 'posix': self.m_nNumAvailableCams = 0 t_lListVidDevs = glob("/dev/video*") self.m_nNumAvailableCams = len(t_lListVidDevs) self.widgets['ACQUCamera'].remove_text(0) for cam in range(self.m_nNumAvailableCams): self.widgets['ACQUCamera'].append_text(str("/dev/video" + str(cam))) self.widgets['ACQUCamera'].append_text(str("Default")) self.m_sCurrentActive = 'file' #load properties values block_properties = self.m_oPropertiesXML.getTag("properties").getTag( "block").getChildTags("property") for Property in block_properties: name = Property.getAttr("name") value = Property.getAttr("value") if name == "type": if value == "file": self.widgets['ACQURadioFile'].set_active(True) self.on_ACQURadioFile_pressed() elif value == "camera": self.widgets['ACQURadioCapture'].set_active(True) self.on_ACQURadioCapture_pressed() self.m_sCurrentActive = 'camera' elif value == "live": self.widgets['ACQURadioLive'].set_active(True) self.on_ACQURadioLive_pressed() self.m_sCurrentActive = 'live' elif value == "video": self.widgets['ACQURadioVideo'].set_active(True) self.on_ACQURadioVideo_pressed() self.m_sCurrentActive = 'video' else: self.widgets['ACQURadioNewImage'].set_active(True) self.on_ACQURadioNewImage_pressed() self.m_sCurrentActive = 'newimage' if name == "filename": self.widgets['ACQUFilename'].set_text(value) if name == "video_name": self.widgets['video_name'].set_text(value) if name == "camera" or name == 'live': if os.name == 'posix': if int(value) < self.m_nNumAvailableCams: self.widgets['ACQUCamera'].set_active(int(value)) else: self.widgets['ACQUCamera'].set_active( self.m_nNumAvailableCams) #will set None if name == "frameRate": self.widgets['frameRate'].set_value(float(value)) # Use the property size to set the New Image size too. if name == "size": if value == "1024x768": self.widgets['ACQUSize'].set_active(0) if value == "800x600": self.widgets['ACQUSize'].set_active(1) if value == "832x624": self.widgets['ACQUSize'].set_active(2) if value == "640x480": self.widgets['ACQUSize'].set_active(3) else: self.widgets['ACQUSize'].set_active(0) # New Image size self.widgets['ACQUWidth'].set_value( float(value[:value.find('x')])) self.widgets['ACQUHeight'].set_value( float(value[value.find('x') + 1:])) self.configure()