Commits

windwiny committed be73fd7

add enable/disable auto scroll log

Comments (0)

Files changed (1)

     return grsyncdlg(parent)
 
 [wxID_GRSYNCDLG, wxID_GRSYNCDLGBTNCLOSE, wxID_GRSYNCDLGBTNHELP, 
- wxID_GRSYNCDLGBTNSTOP, wxID_GRSYNCDLGBTNSYNC, wxID_GRSYNCDLGCHK_A, 
- wxID_GRSYNCDLGCHK_R, wxID_GRSYNCDLGCHK_T, wxID_GRSYNCDLGCHK_V, 
- wxID_GRSYNCDLGCHK_Z, wxID_GRSYNCDLGCHK__DELETE, wxID_GRSYNCDLGCHK__DRY_RUN, 
- wxID_GRSYNCDLGCHK__UPDATE, wxID_GRSYNCDLGPANEL1, wxID_GRSYNCDLGSTATICTEXT1, 
- wxID_GRSYNCDLGSTATICTEXT2, wxID_GRSYNCDLGSTATICTEXT3, 
- wxID_GRSYNCDLGSTATICTEXT4, wxID_GRSYNCDLGSTCSYNCLOG, wxID_GRSYNCDLGTXTDST, 
- wxID_GRSYNCDLGTXTEXCLUDE, wxID_GRSYNCDLGTXTOTHER, wxID_GRSYNCDLGTXTSRC, 
-] = [wx.NewId() for _init_ctrls in range(23)]
+ wxID_GRSYNCDLGBTNSTOP, wxID_GRSYNCDLGBTNSYNC, wxID_GRSYNCDLGCHKPIN, 
+ wxID_GRSYNCDLGCHK_A, wxID_GRSYNCDLGCHK_R, wxID_GRSYNCDLGCHK_T, 
+ wxID_GRSYNCDLGCHK_V, wxID_GRSYNCDLGCHK_Z, wxID_GRSYNCDLGCHK__DELETE, 
+ wxID_GRSYNCDLGCHK__DRY_RUN, wxID_GRSYNCDLGCHK__UPDATE, wxID_GRSYNCDLGPANEL1, 
+ wxID_GRSYNCDLGSTATICTEXT1, wxID_GRSYNCDLGSTATICTEXT2, 
+ wxID_GRSYNCDLGSTATICTEXT3, wxID_GRSYNCDLGSTATICTEXT4, 
+ wxID_GRSYNCDLGSTCSYNCLOG, wxID_GRSYNCDLGTXTDST, wxID_GRSYNCDLGTXTEXCLUDE, 
+ wxID_GRSYNCDLGTXTOTHER, wxID_GRSYNCDLGTXTSRC, 
+] = [wx.NewId() for _init_ctrls in range(24)]
 
 class grsyncdlg(wx.Frame):
     def _init_coll_boxSizer1_Items(self, parent):
         self.chk_r.SetValue(False)
         self.chk_r.Bind(wx.EVT_CHECKBOX, self.OnChk_x, id=wxID_GRSYNCDLGCHK_R)
 
+        self.chkpin = wx.CheckBox(id=wxID_GRSYNCDLGCHKPIN, label=u'pin',
+              name=u'chkpin', parent=self.panel1, pos=wx.Point(664, 40),
+              size=wx.Size(63, 14), style=0)
+        self.chkpin.SetValue(False)
+        self.chkpin.Bind(wx.EVT_CHECKBOX, self.OnChkpinCheckbox,
+              id=wxID_GRSYNCDLGCHKPIN)
+
+        self.btnHelp = wx.Button(id=wxID_GRSYNCDLGBTNHELP, label=u'?',
+              name=u'btnHelp', parent=self.panel1, pos=wx.Point(664, 8),
+              size=wx.Size(35, 24), style=0)
+        self.btnHelp.Bind(wx.EVT_BUTTON, self.OnBtnHelpButton,
+              id=wxID_GRSYNCDLGBTNHELP)
+
         self.btnsync = wx.Button(id=wxID_GRSYNCDLGBTNSYNC, label=u'RUN ...',
               name=u'btnsync', parent=self.panel1, pos=wx.Point(480, 64),
               size=wx.Size(80, 48), style=0)
         self.btnStop.Bind(wx.EVT_BUTTON, self.OnBtnStopButton,
               id=wxID_GRSYNCDLGBTNSTOP)
 
-        self.btnHelp = wx.Button(id=wxID_GRSYNCDLGBTNHELP, label=u'?',
-              name=u'btnHelp', parent=self.panel1, pos=wx.Point(664, 24),
-              size=wx.Size(35, 24), style=0)
-        self.btnHelp.Bind(wx.EVT_BUTTON, self.OnBtnHelpButton,
-              id=wxID_GRSYNCDLGBTNHELP)
-
         self.btnClose = wx.Button(id=wxID_GRSYNCDLGBTNCLOSE, label=u'Close',
               name=u'btnClose', parent=self.panel1, pos=wx.Point(640, 64),
               size=wx.Size(51, 48), style=0)
         self.Bind(wx.EVT_TIMER, self.OnTimerUp, id=nid)
         self.timer1.Start(100)
 
+        self.autoscroll = True
         self.sp = []
         self.dataout = []
         self.dataerr = []
 
+    def OnChkpinCheckbox(self, event):
+        event.Skip()
+        self.autoscroll = not self.autoscroll
+
     def OnGrsyncdlgClose(self, event):
         event.Skip()
         print ' OnGrsyncdlgClose'
             data = ''.join(self.dataout[:i])
             del self.dataout[:i]
             self.stcSyncLog.AppendText(data.decode(G.str_encode, 'replace'))
-            if self.stcSyncLog.GetLineVisible(self.stcSyncLog.GetLineCount()):
+            if self.autoscroll:
                 self.stcSyncLog.GotoLine(self.stcSyncLog.GetLineCount())
         i = len(self.dataerr)
         if i != 0:
             data = ''.join(self.dataerr[:i])
             del self.dataerr[:i]
             self.stcSyncLog.AppendText(data.decode(G.str_encode, 'replace'))
-            if self.stcSyncLog.GetLineVisible(self.stcSyncLog.GetLineCount()):
+            if self.autoscroll:
                 self.stcSyncLog.GotoLine(self.stcSyncLog.GetLineCount())
 
     def getcmd(self):