예제 #1
0
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nMyTerm is a RS232 serial port communication utility.'
            
            '\n\nAiming at debugging easily, We added some special '
            'functions to "MyTerm for-YellowStone":'
            '\n >Transmit data as hexadecimal.'
            '\n >Set columns width when save log to a file'
            '\n >Read data from scripts and transmit them'
            '\n\nSpecial Thanks to Xiuru Chen. He has helped '
            'me fix many bugs and given many suggestions.'
            ,
            335, wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [ appInfo.author ]
        info.License = wordwrap(appInfo.copyright, 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #2
0
    def OnAbout(self, evt=None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nMyTerm is a RS232 serial port communication utility.'
            '\n\nAiming at debugging easily, We added some special '
            'functions to "MyTerm for-YellowStone":'
            '\n >Transmit data as hexadecimal.'
            '\n >Set columns width when save log to a file'
            '\n >Read data from scripts and transmit them'
            '\n\nSpecial Thanks to Xiuru Chen. He has helped '
            'me fix many bugs and given many suggestions.', 335,
            wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [appInfo.author]
        info.License = wordwrap(appInfo.copyright, 500,
                                wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #3
0
파일: main.py 프로젝트: gamesun/MyTerm
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = AppTitle
        info.Version = AppVersion
        info.Copyright = "Copywrong All Lefts Unreserved."
        info.Description = wordwrap(
            '\nMyTerm offer a great solution for RS232 serial port communication.'
            '\n\nIts other features including detecting the valid serial ports, '
            'receiving data from serial ports and viewing it in ASCII text or hexadecimal formats, '
            'echoing the sending data in local or not.',
            350, wx.ClientDC(self.frame))
        info.WebSite = ("https://github.com/gamesun/MyTerm#myterm", "MyTerm Home Page")
        info.Developers = [ "sun.yt" ]
        info.License = wordwrap("(C) 2013 Programmers and Coders Everywhere", 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #4
0
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nThe "MyTerm for-WangH" has special functions aiming at debugging easily in my friend Wang.H\'s work. '
            '\n> Display the csv files\' contect.'
            '\n> Edit csv files.'
            '\n> Transmitting the data from csv files.',
            375, wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [ appInfo.author ]
        info.License = wordwrap(appInfo.copyright, 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #5
0
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '                              ...'
            '                               \n'
            '                              ...'
            '                               \n'
            '                              ...'
            '                                 ',
            335, wx.ClientDC(self.frame))
        #info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [ appInfo.author ]
        info.License = wordwrap(appInfo.copyright, 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        wx.AboutBox(info)
예제 #6
0
파일: main.py 프로젝트: gamesun/MyTerm
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nMyTerm is a RS232 serial port communication utility that can '
            'display the received data either in hexadecimal or ASCII format, '
            'allowing you to configure the connection parameters.'
            '\n\nIts other features including detecting the valid serial '
            'ports, echoing the sending data in local or not.',
            335, wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [ appInfo.author ]
        info.License = wordwrap(appInfo.copyright, 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #7
0
    def OnAbout(self, evt = None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nMyTerm for FCVS offer a great solution for communication with the "Frequency-Controlled Voltage Source".\n\n'
            '"MyTerm for FCVS" development is based on MyTerm, which offer a great solution for RS232 serial port communication.\n\n'
            'Press button "GetInfo" to display all parameters setting in FCVS.\n'
            'Press button "SetInfo" to transmit all parameters to FCVS.\n'
            'Press button "Save" to let FCVS save all parameters into its EEPROM.\n'
            'Press button "Clear Stage" to clear the stage to start a new voyage.\n',
            550, wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, ("%s Home Page" % appInfo.title))
        info.Developers = [ "sun.yt" ]
        info.License = wordwrap("(C) 2013 Programmers and Coders Everywhere", 500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #8
0
파일: main.py 프로젝트: watte1997/MyTerm
    def OnAbout(self, evt=None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = AppTitle
        info.Version = AppVersion
        info.Copyright = "Copywrong All Lefts Unreserved."
        info.Description = wordwrap(
            '\nMyTerm offer a great solution for RS232 serial port communication.'
            '\n\nIts other features including detecting the valid serial ports, '
            'receiving data from serial ports and viewing it in ASCII text or hexadecimal formats, '
            'echoing the sending data in local or not.', 350,
            wx.ClientDC(self.frame))
        info.WebSite = ("https://github.com/gamesun/MyTerm#myterm",
                        "MyTerm Home Page")
        info.Developers = ["sun.yt"]
        info.License = wordwrap("(C) 2013 Programmers and Coders Everywhere",
                                500, wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #9
0
파일: main.py 프로젝트: watte1997/MyTerm
    def OnAbout(self, evt=None):
        # First we create and fill the info object
        info = wx.AboutDialogInfo()
        info.Name = appInfo.title
        info.Version = appInfo.version
        info.Copyright = appInfo.copyright
        info.Description = wordwrap(
            '\nMyTerm is a RS232 serial port communication utility that can '
            'display the received data either in hexadecimal or ASCII format, '
            'allowing you to configure the connection parameters.'
            '\n\nIts other features including detecting the valid serial '
            'ports, echoing the sending data in local or not.', 335,
            wx.ClientDC(self.frame))
        info.WebSite = (appInfo.url, "Home Page")
        info.Developers = [appInfo.author]
        info.License = wordwrap(appInfo.copyright, 500,
                                wx.ClientDC(self.frame))

        info.Icon = icon32.geticon32Icon()

        # Then we call wx.AboutBox giving it that info object
        wx.AboutBox(info)
예제 #10
0
    def OnInit(self):
        self.frame = layout.myFrame(None)

        if sys.platform == 'win32':
            my_data = pkg_resources.resource_string(__name__,"library.zip")
            filezip = StringIO(my_data)
            zf = zipfile.ZipFile(filezip)
            data = zf.read("media/icon16.ico")
            icon = wx.EmptyIcon()
            icon.CopyFromBitmap(wx.ImageFromStream(StringIO(data), wx.BITMAP_TYPE_ICO).ConvertToBitmap())
            self.frame.SetIcon(icon)                        # for the app's title of main window
            self.frame.SetIcon(icon32.geticon32Icon())      # for the app's task bar
        elif sys.platform.startswith('linux'):
            self.frame.SetIcon(icon32.geticon32Icon())
            
        self.frame.wdTitle.SetScrollRate(10, WF_H_OFFSET / 2)
        self.frame.wdCanvas.SetScrollRate(10, WF_H_OFFSET / 2)

        colorDatabase = wx.ColourDatabase()
        self.Tcolor = [
          colorDatabase.Find('ORANGE RED'),
          (255, 165, 0),#colorDatabase.Find('ORANGE1'),
          colorDatabase.Find('SKY BLUE'),
          colorDatabase.Find('SPRING GREEN'),
          (191, 62, 255),#colorDatabase.Find('DARKORCHID1'),
          (255, 106, 106),#colorDatabase.Find('INDIANRED1'),
          (0, 229, 238),#colorDatabase.Find('TURQUOISE2'),
          colorDatabase.Find('GREY'),
        ]

        # Make a menu
        menuBar = wx.MenuBar()

        # 1st menu from left
        menu = wx.Menu()
        menu.Append(wx.ID_OPEN,    "&Open log", "Open a log file to display.")
        menu.Append(wx.ID_CLOSE,   "&Close", "Close the log file.")
        menu.AppendSeparator()
        menu.Append(wx.ID_EXIT,    "&Exit", "Exit The Tool")
        menu.Enable(wx.ID_CLOSE, False)
        menuBar.Append(menu, "&File")

        # and a file history
        self.filehistory = wx.FileHistory()
        self.filehistory.UseMenu(menu)

        # 2nd menu
        menuSignLabel = wx.Menu()
        id_openSigFile = wx.NewId()
        menuSignLabel.Append(id_openSigFile, "&Open Sig", "Load signal labels form a *.sig file.")
        menuBar.Append(menuSignLabel, "&Signal")

        # 3rd menu
        menuZoom = wx.Menu()
        for i in range(1, 17):
            exec('idZoom%d = wx.NewId()' % i)
        menuZoom.AppendRadioItem(idZoom1, "500%" )
        menuZoom.AppendRadioItem(idZoom2, "400%" )
        menuZoom.AppendRadioItem(idZoom3, "300%" )
        menuZoom.AppendRadioItem(idZoom4, "250%" )
        menuZoom.AppendRadioItem(idZoom5, "200%" )
        menuZoom.AppendRadioItem(idZoom6, "150%" )
        menuZoom.AppendRadioItem(idZoom7, "100%" )
        menuZoom.AppendRadioItem(idZoom8, "75%"  )
        menuZoom.AppendRadioItem(idZoom9, "50%"  )
        menuZoom.AppendRadioItem(idZoom10, "20%" )
        menuZoom.AppendRadioItem(idZoom11, "10%" )
        menuZoom.AppendRadioItem(idZoom12, "5%" )
        menuZoom.AppendRadioItem(idZoom13, "3%" )
        menuZoom.AppendRadioItem(idZoom14, "1%" )
        menuZoom.AppendRadioItem(idZoom15, "0.5%" )
        menuZoom.AppendRadioItem(idZoom16, "0.1%" )
        menuBar.Append(menuZoom, "&Zoom")

        # 4th menu
        menuFunc = wx.Menu()
        idAutoAlign = wx.NewId()
        menuFunc.AppendCheckItem(idAutoAlign, "&AutoAlign", "Auto align a measure line to rising edge or falling edge.")
        menuBar.Append(menuFunc, "Fun&c")

        # 5th menu
        menuHelp = wx.Menu()
        menuHelp.Append(wx.ID_ABOUT, "&About")
        menuBar.Append(menuHelp, "&Help")

        self.frame.SetMenuBar(menuBar)

        menuBar.Check(idZoom7, True)
        menuBar.Check(idAutoAlign, True)

        # Make a statusbar
        self.statusbar = self.frame.CreateStatusBar(4, wx.ST_SIZEGRIP)
        self.statusbar.SetStatusWidths([-1, 180, 100, 70])
        # statusbar fields
        statusbar_fields = ["", "", "", "100.00%"]
        for i in range(len(statusbar_fields)):
            self.statusbar.SetStatusText(statusbar_fields[i], i)
            
        self.zoomFactor = 1.0
        self.autoAlign = True
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer.Start(10)    # ms

        self.frame.window_1.Bind(wx.EVT_SPLITTER_DCLICK, self.OnSplitterDClick)

        self.frame.pnlCanvas.Bind(wx.EVT_PAINT, self.OnPaint)
        self.frame.wdTitle.Bind(wx.EVT_SCROLLWIN, self.OnTitleScroll)
        self.frame.wdCanvas.Bind(wx.EVT_SCROLLWIN, self.OnCanvasScroll)

        self.frame.pnlCanvas.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.frame.pnlCanvas.Bind(wx.EVT_RIGHT_UP, self.OnMouseRightUp)

        self.frame.Bind(wx.EVT_MENU, self.OnOpenFile, id=wx.ID_OPEN)
        self.frame.Bind(wx.EVT_MENU, self.OnOpenSigFile, id=id_openSigFile)

        self.frame.Bind(wx.EVT_MENU, self.OnExitApp, id=wx.ID_EXIT)
        self.frame.Bind(wx.EVT_MENU_RANGE, self.OnFileHistory, id=wx.ID_FILE1, id2=wx.ID_FILE9)
        self.frame.Bind(wx.EVT_WINDOW_DESTROY, self.Cleanup)

        for i in range(1, 17):
            eval('self.frame.Bind(wx.EVT_MENU, self.OnZoom%d, id = idZoom%d)' % (i, i))

        self.frame.Bind(wx.EVT_MENU, self.OnAutoAlign, id = idAutoAlign)

        self.frame.Bind(wx.EVT_MENU, self.OnAbout, id = wx.ID_ABOUT)

        for i in range(1, 9):
            eval('self.frame.lblMeasure_T%d.Bind(wx.EVT_LEFT_DOWN, self.OnClickMeasure_T%d)' % (i, i))
            eval('self.frame.lblMeasure_T%d.Bind(wx.EVT_ENTER_WINDOW, lambda evt, self = self: self.OnEnterMeasure_T(evt, %d))' % (i, i))
            eval('self.frame.lblMeasure_T%d.Bind(wx.EVT_LEAVE_WINDOW, lambda evt, self = self: self.OnLeaveMeasure_T(evt, %d))' % (i, i))
            exec('self.frame.lblMeasure_T%d.SetForegroundColour(self.Tcolor[i-1])' % i)
            exec('self.frame.lblMeasure_T%d.SetCursor(wx.StockCursor(wx.CURSOR_HAND))' % i)
            eval("self.frame.label_T%d.SetLabel('')" % i)

        for i in range(1, 8):
            eval("self.frame.label_sub%d%d.SetLabel('')" % (i, i + 1))

        for i in range(1, 33):
            label = "%02d:        " % (33 - i)
            eval("self.frame.label_%d.SetLabel(label)" % i)
            eval("self.frame.label_%d.SetMinSize((-1, %d))" % (i, WF_H_OFFSET))
            eval("self.frame.label_%d.Bind(wx.EVT_LEFT_UP, lambda evt, self = self: self.OnLeftUpLabel(evt, %d))" % (i, i))
            eval("self.frame.label_%d.Bind(wx.EVT_ENTER_WINDOW, lambda evt, self = self: self.OnEnterLabel(evt, %d))" % (i, i))
            eval("self.frame.label_%d.Bind(wx.EVT_LEAVE_WINDOW, lambda evt, self = self: self.OnLeaveLabel(evt, %d))" % (i, i))
        self.frame.label_topSpacer.SetMinSize((-1, WF_TOP_MARGIN - 3))
        self.frame.wdTitle.GetSizer().Layout()

        self.frame.Bind(pcs.EVT_COLOR_SELECT, self.OnColorSelect)
        self.frame.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.frame.wdTitle.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.frame.wdCanvas.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)

        self.sizerSigLabel = self.frame.wdTitle.GetSizer()

        self.SetTopWindow(self.frame)
        self.frame.Show()

        self.canvasSize = wx.Size()
        self.canvasFullSize = wx.Size(0, 32 * WF_H_OFFSET + WF_TOP_MARGIN)
        self.mousePosOld = (0, 0)
        self.originWave = []
        self.waveform = []
        self.paintWaveform = []
        self.arrow = None
        self.pcsWin = None
        
        self.movingT = None
        self.movingT_x = 0

        self.MeasureT_x = [[None, None] for i in range(8)]

        self.mouseEntered1 = False

        self.sigFilePath = ""
        self.signalLabel = ["%02d:" % i for i in range(32, 0, -1)]

        self.labelColorSelectFocus = None
        self.waveformColor = [wx.Colour(0, 0, 0) for i in range(32)]
        self.gridColor = [wx.Colour(150, 150, 150) for i in range(32)]
        self.rectColor = [wx.Colour(224, 224, 224) for i in range(32)]

        self.config = ConfigParser.RawConfigParser()
        self.LoadSettings()

        return True
예제 #11
0
    def OnInit(self):
        self.frame = ui.MyFrame(None, wx.ID_ANY, "")

        if sys.platform == 'win32':
            my_data = pkg_resources.resource_string(__name__,"library.zip")
            filezip = StringIO(my_data)
            zf = zipfile.ZipFile(filezip)
            data = zf.read("media/icon16.ico")
            icon = wx.EmptyIcon()
            icon.CopyFromBitmap(wx.ImageFromStream(StringIO(data), wx.BITMAP_TYPE_ICO).ConvertToBitmap())
            self.frame.SetIcon(icon)                        # for the app's title of main window
            self.frame.SetIcon(icon32.geticon32Icon())      # for the app's task bar
        elif sys.platform.startswith('linux'):
            self.frame.SetIcon(icon32.geticon32Icon())

#         self.frame.SetIcon(wx.Icon("media\icon16.ico", wx.BITMAP_TYPE_ICO, 16, 16))

        self.frame.SplitterWindow.SetSashSize(0)
        self.frame.SplitterWindow.SetSashPosition(SASHPOSITION, True)

#         self.frame.cmbPort.AppendItems(('COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8'))

        self.OnEnumPorts()

        # Make a menu
        self.menuBar = wx.MenuBar()
        self.MakeMenu(self.menuBar, MenuDefs)
        self.frame.SetMenuBar(self.menuBar)

        # initial variables
        self.rxmode = ASCII
        self.txmode = ASCII
        self.localEcho = False
        self.rxCount = 0
        self.txCount = 0
        self.csvFilePath = ""
        
        self.menuBar.Check(MENU_ID_RX_HEX_U, True)
        self.OnRxHexModeUppercase()
        
        self.config = ConfigParser.RawConfigParser()
        self.LoadSettings()

        self.csvData = []
        self.frame.grid_csv.SetRowLabelSize(0)
        rows = self.frame.grid_csv.GetNumberRows()
        for row in range(rows):
            self.frame.grid_csv.SetRowSize(row, 20)
        
        # bind events
        self.frame.btnHideBar.Bind(wx.EVT_BUTTON, self.OnHideSettingBar)
        self.frame.btnOpen.Bind(wx.EVT_BUTTON, self.OnBtnOpen)
        self.frame.btnEnumPorts.Bind(wx.EVT_BUTTON, self.OnEnumPorts)
        self.frame.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        self.frame.btnTransmitHex.Bind(wx.EVT_BUTTON, self.OnTransmitHex)
        
#         self.frame.Bind(wx.EVT_WINDOW_DESTROY, self.Cleanup)
        self.frame.Bind(wx.EVT_CLOSE, self.Cleanup)

        self.Bind(EVT_SERIALRXCNT, self.OnSerialRxCnt)
        self.Bind(EVT_SERIALEXCEPT, self.OnSerialExcept)
        self.frame.txtctlMain.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.frame.txtctlMain.Bind(wx.EVT_CHAR, self.OnSerialWrite)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_PASTE, self.OnPaste)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_URL, self.OnURL)

        self.frame.grid_csv.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange)

        for i in range(1, 51):
            exec("self.frame.button_%d.Bind(wx.EVT_BUTTON, lambda evt, self = self: self.OnSendCmd(evt, %d))" % (i, i))
        
        self.SetTopWindow(self.frame)
        self.frame.SetTitle( appInfo.title )
        self.frame.Show()

        self.evtPortOpen = threading.Event()

        return True
예제 #12
0
파일: main.py 프로젝트: gamesun/MyTerm
    def OnInit(self):
        self.frame = ui.MyFrame(None, wx.ID_ANY, "")

        if sys.platform == 'win32':
            my_data = pkg_resources.resource_string(__name__,"library.zip")
            filezip = StringIO(my_data)
            zf = zipfile.ZipFile(filezip)
            data = zf.read("media/icon16.ico")
            icon = wx.EmptyIcon()
            icon.CopyFromBitmap(wx.ImageFromStream(StringIO(data), wx.BITMAP_TYPE_ICO).ConvertToBitmap())
            self.frame.SetIcon(icon)                        # for the app's title of main window
            self.frame.SetIcon(icon32.geticon32Icon())      # for the app's task bar
        elif sys.platform.startswith('linux'):
            self.frame.SetIcon(icon32.geticon32Icon())

#         self.frame.SetIcon(wx.Icon("media\icon16.ico", wx.BITMAP_TYPE_ICO, 16, 16))

        self.frame.SplitterWindow.SetSashSize(2)
        self.frame.SplitterWindow.SetSashPosition(SASHPOSITION, True)

#         self.frame.cmbPort.AppendItems(('COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8'))

        self.OnEnumPorts()

        # Make a menu
        self.menuBar = wx.MenuBar()
        self.MakeMenu(self.menuBar, MenuDefs)
        self.frame.SetMenuBar(self.menuBar)

        # initial variables
        self.rxmode = ASCII
        self.txmode = ASCII
        self.localEcho = False
        self.rxCount = 0
        self.txCount = 0
        self.transmitHexPanel = False
        self.HideTransmitHexPanel()

        # bind events
        self.frame.btnHideBar.Bind(wx.EVT_BUTTON, self.OnHideSettingBar)
        self.frame.btnOpen.Bind(wx.EVT_BUTTON, self.OnBtnOpen)
        self.frame.btnEnumPorts.Bind(wx.EVT_BUTTON, self.OnEnumPorts)
        self.frame.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        self.frame.btnTransmitHex.Bind(wx.EVT_BUTTON, self.OnTransmitHex)

#         self.frame.Bind(wx.EVT_WINDOW_DESTROY, self.Cleanup)
        self.frame.Bind(wx.EVT_CLOSE, self.Cleanup)

        self.Bind(EVT_SERIALRXCNT, self.OnSerialRxCnt)
        self.Bind(EVT_SERIALEXCEPT, self.OnSerialExcept)
        self.frame.txtctlMain.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.frame.txtctlMain.Bind(wx.EVT_CHAR, self.OnSerialWrite)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_PASTE, self.OnPaste)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_URL, self.OnURL)

        self.frame.SplitterWindow.Bind(wx.EVT_SPLITTER_DCLICK, self.OnSplitterDClick)

        self.SetTopWindow(self.frame)
        self.frame.SetTitle( appInfo.title )
        self.frame.Show()

        self.config = ConfigParser.RawConfigParser()
        self.LoadSettings()

        self.evtPortOpen = threading.Event()

        return True
예제 #13
0
파일: main.py 프로젝트: watte1997/MyTerm
    def OnInit(self):
        self.frame = ui.MyFrame(None, wx.ID_ANY, "")

        if sys.platform == 'win32':
            my_data = pkg_resources.resource_string(__name__, "library.zip")
            filezip = StringIO(my_data)
            zf = zipfile.ZipFile(filezip)
            data = zf.read("media/icon16.ico")
            icon = wx.EmptyIcon()
            icon.CopyFromBitmap(
                wx.ImageFromStream(StringIO(data),
                                   wx.BITMAP_TYPE_ICO).ConvertToBitmap())
            self.frame.SetIcon(icon)  # for the app's title of main window
            self.frame.SetIcon(
                icon32.geticon32Icon())  # for the app's task bar
        elif sys.platform.startswith('linux'):
            self.frame.SetIcon(icon32.geticon32Icon())

#         self.frame.SetIcon(wx.Icon("media\icon16.ico", wx.BITMAP_TYPE_ICO, 16, 16))

        self.frame.SplitterWindow.SetSashSize(2)
        self.frame.SplitterWindow.SetSashPosition(SASHPOSITION, True)

        #         self.frame.cmbPort.AppendItems(('COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8'))

        self.OnEnumPorts()

        # Make a menu
        self.menuBar = wx.MenuBar()
        self.MakeMenu(self.menuBar, MenuDefs)
        self.frame.SetMenuBar(self.menuBar)

        # initial variables
        self.rxmode = ASCII
        self.txmode = ASCII
        self.localEcho = False
        self.rxCount = 0
        self.txCount = 0
        self.transmitHexPanel = False
        self.HideTransmitHexPanel()

        # bind events
        self.frame.btnHideBar.Bind(wx.EVT_BUTTON, self.OnHideSettingBar)
        self.frame.btnOpen.Bind(wx.EVT_BUTTON, self.OnBtnOpen)
        self.frame.btnEnumPorts.Bind(wx.EVT_BUTTON, self.OnEnumPorts)
        self.frame.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        self.frame.btnTransmitHex.Bind(wx.EVT_BUTTON, self.OnTransmitHex)

        #         self.frame.Bind(wx.EVT_WINDOW_DESTROY, self.Cleanup)
        self.frame.Bind(wx.EVT_CLOSE, self.Cleanup)

        self.Bind(EVT_SERIALRXCNT, self.OnSerialRxCnt)
        self.Bind(EVT_SERIALEXCEPT, self.OnSerialExcept)
        self.frame.txtctlMain.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.frame.txtctlMain.Bind(wx.EVT_CHAR, self.OnSerialWrite)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_PASTE, self.OnPaste)
        self.frame.txtctlMain.Bind(wx.EVT_TEXT_URL, self.OnURL)

        self.frame.SplitterWindow.Bind(wx.EVT_SPLITTER_DCLICK,
                                       self.OnSplitterDClick)

        self.SetTopWindow(self.frame)
        self.frame.SetTitle(appInfo.title)
        self.frame.Show()

        self.config = ConfigParser.RawConfigParser()
        self.LoadSettings()

        self.evtPortOpen = threading.Event()

        return True