码迷,mamicode.com
首页 > 其他好文 > 详细

dddd

时间:2017-08-01 23:11:43      阅读:1133      评论:0      收藏:0      [点我收藏+]

标签:数据   utf-8   hint   getch   exp   enc   ict   style   horizon   

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

import wx
import modelmngr_execute

##########################################################################################
class MyFrame1 ( wx.Frame ):
    
    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"模型管家", pos = wx.DefaultPosition, size = wx.Size( 779,521 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
	
        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )

	####################################################
        bSizer6 = wx.BoxSizer( wx.VERTICAL )

	####################################################
        bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"模型文件1路径 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText6.Wrap( -1 )
        bSizer7.Add( self.m_staticText6, 0, wx.ALL, 5 )
		
        self.m_textCtrl6 = wx.TextCtrl( self, wx.ID_ANY, u"/system/etc/models/fsrcn.cambricon", wx.DefaultPosition, wx.Size( 650,-1 ), 0 )
        bSizer7.Add( self.m_textCtrl6, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer7, 1, wx.EXPAND, 5 )

        ########################
        bSizer90 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_checkBox2 = wx.CheckBox( self, wx.ID_ANY, u"是否加密 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer90.Add( self.m_checkBox2, 0, wx.ALL, 5 )
        
        self.Bind(wx.EVT_CHECKBOX, self.on_model1_check, self.m_checkBox2)
		
        self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"模型文件1密钥", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText19.Wrap( -1 )
        bSizer90.Add( self.m_staticText19, 0, wx.ALL, 5 )
		
        self.m_textCtrl19 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
        bSizer90.Add( self.m_textCtrl19, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer90, 1, wx.EXPAND, 5 )

        ####################################################
        bSizer24 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText20 = wx.StaticText( self, wx.ID_ANY, u"模型文件2路径", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText20.Wrap( -1 )
        bSizer24.Add( self.m_staticText20, 0, wx.ALL, 5 )
		
        self.m_textCtrl20 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 650,-1 ), 0 )
        bSizer24.Add( self.m_textCtrl20, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer24, 1, wx.EXPAND, 5 )

        ########################
        bSizer12 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_checkBox3 = wx.CheckBox( self, wx.ID_ANY, u"是否加密", wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer12.Add( self.m_checkBox3, 0, wx.ALL, 5 )

        self.Bind(wx.EVT_CHECKBOX, self.on_model2_check, self.m_checkBox3)
		
        self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, u"模型文件2密钥", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText21.Wrap( -1 )
        bSizer12.Add( self.m_staticText21, 0, wx.ALL, 5 )
		
        self.m_textCtrl21 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
        bSizer12.Add( self.m_textCtrl21, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer12, 1, wx.EXPAND, 5 )

	####################################################
        bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText22 = wx.StaticText( self, wx.ID_ANY, u"模型类型 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText22.Wrap( -1 )
        bSizer31.Add( self.m_staticText22, 0, wx.ALL, 5 )
		
        m_choice1Choices = [ u"在线模型(0)", u"离线模型(1)" ]
        self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
        self.m_choice1.SetSelection( 0 )
        bSizer31.Add( self.m_choice1, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer31, 1, wx.EXPAND, 5 )

	####################################################
        bSizer32 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText29 = wx.StaticText( self, wx.ID_ANY, u"框架类型 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText29.Wrap( -1 )
        bSizer32.Add( self.m_staticText29, 0, wx.ALL, 5 )
		
        m_choice3Choices = [ u"无(0)", u"TensorFlow(1)", u"KalDi(2)", u"Caffe(3)"]
        self.m_choice3 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
        self.m_choice3.SetSelection( 0 )
        bSizer32.Add( self.m_choice3, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer32, 1, wx.EXPAND, 5 )

	####################################################
        bSizer33 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText30 = wx.StaticText( self, wx.ID_ANY, u"源数据(图片)路径 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText30.Wrap( -1 )
        bSizer33.Add( self.m_staticText30, 0, wx.ALL, 5 )
		
        self.m_textCtrl27 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 500,-1 ), 0 )
        bSizer33.Add( self.m_textCtrl27, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer33, 1, wx.EXPAND, 5 )

	####################################################
        bSizer45 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText31 = wx.StaticText( self, wx.ID_ANY, u"输入尺寸N *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText31.Wrap( -1 )
        bSizer45.Add( self.m_staticText31, 0, wx.ALL, 5 )
		
        self.m_textCtrl28 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer45.Add( self.m_textCtrl28, 0, wx.ALL, 5 )
	
        self.m_staticText32 = wx.StaticText( self, wx.ID_ANY, u"输入尺寸C *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText32.Wrap( -1 )
        bSizer45.Add( self.m_staticText32, 0, wx.ALL, 5 )
		
        self.m_textCtrl29 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer45.Add( self.m_textCtrl29, 0, wx.ALL, 5 )
		
        self.m_staticText33 = wx.StaticText( self, wx.ID_ANY, u"输入尺寸H *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText33.Wrap( -1 )
        bSizer45.Add( self.m_staticText33, 0, wx.ALL, 5 )
		
        self.m_textCtrl30 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer45.Add( self.m_textCtrl30, 0, wx.ALL, 5 )
		
        self.m_staticText34 = wx.StaticText( self, wx.ID_ANY, u"输入尺寸W *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText34.Wrap( -1 )
        bSizer45.Add( self.m_staticText34, 0, wx.ALL, 5 )
		
        self.m_textCtrl31 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer45.Add( self.m_textCtrl31, 0, wx.ALL, 5 )
		
		
        bSizer6.Add( bSizer45, 1, wx.EXPAND, 5 )

        ####################################################		
        bSizer47 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText35 = wx.StaticText( self, wx.ID_ANY, u"输出尺寸N *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText35.Wrap( -1 )
        bSizer47.Add( self.m_staticText35, 0, wx.ALL, 5 )
		
        self.m_textCtrl32 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer47.Add( self.m_textCtrl32, 0, wx.ALL, 5 )
		
        self.m_staticText36 = wx.StaticText( self, wx.ID_ANY, u"输出尺寸C *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText36.Wrap( -1 )
        bSizer47.Add( self.m_staticText36, 0, wx.ALL, 5 )
		
        self.m_textCtrl33 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer47.Add( self.m_textCtrl33, 0, wx.ALL, 5 )
		
        self.m_staticText37 = wx.StaticText( self, wx.ID_ANY, u"输出尺寸H *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText37.Wrap( -1 )
        bSizer47.Add( self.m_staticText37, 0, wx.ALL, 5 )
		
        self.m_textCtrl34 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer47.Add( self.m_textCtrl34, 0, wx.ALL, 5 )
		
        self.m_staticText38 = wx.StaticText( self, wx.ID_ANY, u"输出尺寸W *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText38.Wrap( -1 )
        bSizer47.Add( self.m_staticText38, 0, wx.ALL, 5 )
	
        self.m_textCtrl35 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
        bSizer47.Add( self.m_textCtrl35, 0, wx.ALL, 5 )
	
	
        bSizer6.Add( bSizer47, 1, wx.EXPAND, 5 )

	####################################################
        bSizer48 = wx.BoxSizer( wx.HORIZONTAL )
		
        self.m_staticText39 = wx.StaticText( self, wx.ID_ANY, u"超时时限 *", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText39.Wrap( -1 )
        bSizer48.Add( self.m_staticText39, 0, wx.ALL, 5 )
	
        self.m_textCtrl36 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer48.Add( self.m_textCtrl36, 0, wx.ALL, 5 )
	
	
        bSizer6.Add( bSizer48, 1, wx.EXPAND, 5 )

	####################################################
        bSizer49 = wx.BoxSizer( wx.VERTICAL )
	
        self.m_button2 = wx.Button( self, wx.ID_ANY, u"模型执行-异步-非级联", wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer49.Add( self.m_button2, 0, wx.ALL, 5 )
	
	
        bSizer6.Add( bSizer49, 1, wx.EXPAND, 5 )

        self.Bind(wx.EVT_BUTTON, self.on_async_single, self.m_button2)
	
	####################################################
        self.SetSizer( bSizer6 )
        self.Layout()
	
        self.Centre( wx.BOTH )

        ###############################################################################################################################################################################
        if self.m_checkBox2.GetValue() == True:
            self.m_textCtrl19.Enable()
        else:
            self.m_textCtrl19.Disable()
            
        if self.m_checkBox3.GetValue() == True:
            self.m_textCtrl21.Enable()
        else:
            self.m_textCtrl21.Disable()            

        
        
    def on_async_single(self, event):
        model1Path = modelmngr_execute._getTextCtrl(self.m_textCtrl6.GetValue()) #1
        model1Encr = modelmngr_execute._getCheckBox(self.m_checkBox2.GetValue()) #2
        model1Key = modelmngr_execute._getTextCtrl(self.m_textCtrl19.GetValue()) #3
        print model1Path, model1Encr, model1Key
        model2Path = modelmngr_execute._getTextCtrl(self.m_textCtrl20.GetValue()) #4
        model2Encr = modelmngr_execute._getCheckBox(self.m_checkBox3.GetValue()) #5
        model2Key = modelmngr_execute._getTextCtrl(self.m_textCtrl21.GetValue()) #6
        print model2Path, model2Encr, model2Key
        modelType = str(self.m_choice1.GetSelection()) #7
        frameworkType = str(self.m_choice3.GetSelection()) #8
        jpgPath = modelmngr_execute._getTextCtrl(self.m_textCtrl27.GetValue()) #9
        print modelType,frameworkType,jpgPath
        srcN = str(self.m_textCtrl28.GetValue()) #10
        srcC = str(self.m_textCtrl29.GetValue()) #11
        srcH = str(self.m_textCtrl30.GetValue()) #12
        srcW = str(self.m_textCtrl31.GetValue()) #13
        print srcN,srcC,srcH,srcW

        dstN = str(self.m_textCtrl32.GetValue()) #14
        dstC = str(self.m_textCtrl33.GetValue()) #15
        dstH = str(self.m_textCtrl34.GetValue()) #16
        dstW = str(self.m_textCtrl35.GetValue()) #17
        print dstN,dstC,dstH,dstW
        timeout = str(self.m_textCtrl36.GetValue()) #18
        print timeout
        
        modelmngr_execute.singleRun_async(model1Path, model1Encr, model1Key, model2Path, model2Encr, model2Key, modelType, frameworkType, jpgPath, srcN, srcC, srcH, srcW, dstN, dstC, dstH, dstW, timeout)
        
        event.Skip()

    def on_model1_check(self, event):
        cb = event.GetEventObject()
        if cb.GetValue() == True:
            self.m_textCtrl19.Enable()
            self.m_textCtrl19.SetValue("")
        else:
            self.m_textCtrl19.Disable()
            self.m_textCtrl19.SetValue("")
        event.Skip()

    def on_model2_check(self, event):
        cb = event.GetEventObject()
        if cb.GetValue() == True:
            self.m_textCtrl21.Enable()
            self.m_textCtrl21.SetValue("")
        else:
            self.m_textCtrl21.Disable()
            self.m_textCtrl21.SetValue("")
        event.Skip()        
	
    def __del__( self ):
        pass

 

dddd

标签:数据   utf-8   hint   getch   exp   enc   ict   style   horizon   

原文地址:http://www.cnblogs.com/fish7/p/7270744.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!