Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mclim9 committed Jul 26, 2020
1 parent 6d59c7d commit 9ccdfe4
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 40 deletions.
22 changes: 10 additions & 12 deletions projects/DebugTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
"""

###############################################################################
### Code Import
### Code Import
###############################################################################
from guiblox import buttonRow, entryCol, theme, listWindow

### Code specific imports
from rssd.yaVISA_socket import jaVisa
from tkinter import messagebox
import datetime
import socket
import os
from guiblox import buttonRow, entryCol, theme, listWindow
from rssd.yaVISA_socket import jaVisa
# from tkinter import messagebox

###############################################################################
### Function Definition
Expand Down Expand Up @@ -94,12 +92,12 @@ def instr1(root):
Instr.debug = 0
Instr.jav_Open(RS.IP1)
for scpi in RS.SCPI1:
if '?' in scpi:
if '?' in scpi:
rdStr = Instr.query(scpi)
Output = Output + ',' + rdStr
else:
Instr.write(scpi)
Output = datetime.datetime.now().strftime("%y%m%d,%H:%M:%S.%f") + Output
Output = datetime.datetime.now().strftime("%y%m%d,%H:%M:%S.%f") + Output
print(Output)
f = open(__file__+'.txt','a')
f.write(Output+'\n')
Expand All @@ -113,13 +111,13 @@ def instr2(root):
Instr.debug = 0
Instr.jav_Open(RS.IP2)
for scpi in RS.SCPI2:
if '?' in scpi:
if '?' in scpi:
rdStr = Instr.query(scpi)
Output = Output + ',' + rdStr
else:
Instr.write(scpi)
f = open(__file__+'.txt','a')
Output = datetime.datetime.now().strftime("%y%m%d,%H:%M:%S.%f") + Output
Output = datetime.datetime.now().strftime("%y%m%d,%H:%M:%S.%f") + Output
print(Output)
f.write(Output+'\n')
f.close()
Expand Down Expand Up @@ -148,7 +146,7 @@ def SaveSetts(root):
### GUI Main
###############################################################################
def main():
global root
# global root
root = theme().addColor()
root.title('Socket Test Program')
root.resizable(0,0)
Expand Down Expand Up @@ -206,4 +204,4 @@ def main():
root.mainloop()

if __name__ == '__main__':
main()
main()
28 changes: 12 additions & 16 deletions projects/IQConvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
#####################################################################

#####################################################################
### OOGUI Import
### OOGUI Import
#####################################################################
from guiblox import buttonRow, entryCol, theme, listWindow

### Code specific imports
import time
import tkinter as tk
from tkinter.filedialog import askopenfilename
from rssd import jaVisa
import time
import os
# import os
from guiblox import buttonRow, entryCol, theme, listWindow
# from rssd import jaVisa
from rssd.iqdata import IQ

#####################################################################
Expand All @@ -34,8 +32,6 @@ def convert(root):
duration = time.time() - start
print(f"IQ:{iq.NumberOfSamples} samples in {duration*1e3:2.2f} ms --> {iq.NumberOfSamples/1e6/duration:3.2f} MSamples/s")

pass

def getFilename(tkEvent):
fny = askopenfilename()
tkEvent.widget.delete(0,tk.END)
Expand All @@ -46,7 +42,7 @@ def getFilename(tkEvent):
### GUI Layout
#####################################################################
def main():
global root
# global root
root = theme().addColor()
root.title('Socket Test Program')
root.resizable(0,0)
Expand All @@ -62,12 +58,12 @@ def main():
root.files.chg2Enum('entry1', ['iq.tar','iqw','wv'])
root.files.chg2Enum('entry3', ['iq.tar','iqw','wv'])

root.files.entry0.bind("<Button-1>",getFilename) #pylint: disable=E1101
root.files.entry2.bind("<Button-1>",getFilename) #pylint: disable=E1101
root.files.entry0.config(width = widdy) #pylint: disable=E1101
root.files.entry1.config(width = widdy-7) #pylint: disable=E1101
root.files.entry2.config(width = widdy) #pylint: disable=E1101
root.files.entry3.config(width = widdy-7) #pylint: disable=E1101
root.files.entry0.bind("<Button-1>",getFilename) #pylint: disable=E1101
root.files.entry2.bind("<Button-1>",getFilename) #pylint: disable=E1101
root.files.entry0.config(width = widdy) #pylint: disable=E1101
root.files.entry1.config(width = widdy-7) #pylint: disable=E1101
root.files.entry2.config(width = widdy) #pylint: disable=E1101
root.files.entry3.config(width = widdy-7) #pylint: disable=E1101

root.bottWind.listWindow.config(height= 5,width=50)
root.buttnRow.button0.config(text='Convert' ,command=lambda: convert(root)) #pylint: disable=E1101
Expand Down
136 changes: 136 additions & 0 deletions projects/RS_Options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
###############################################################################
### Purpose: Object Oriented Python Tkinter example
### Author : Martin C Lim
### Date : 2019.02.01
###############################################################################
### User Inputs
###############################################################################
SCPIWidth = 50
SCPIHeigh = 5

##############################################################################
### Code Import
###############################################################################
import datetime
import os

from guiblox import buttonRow, entryCol, theme, listWindow
from rssd.yaVISA_socket import jaVisa
# from tkinter import messagebox

###############################################################################
### Function Definition
###############################################################################
def clrBottom(root):
root.bottWind.clear()
# root.bottWind.writeH('2xLt:IDN Rt:SystError 2xRt:SystInfo')

def fopen():
os.system('notepad.exe ' + __file__ + '.txt')

def fwrite(root):
RS = gui_reader(root)
f = open(__file__+'.txt', 'a')
f.write(datetime.datetime.now().strftime("%y%m%d-%H:%M:%S.%f")+'\n') #Date String
f.write(RS.Output)
print(f'Text Written to {__file__}')
f.close()

def gui_reader(root):
### Read values from GUI
RS = lambda: None
RS.IP1 = root.entryCol1.entry0.get() #pylint:disable=E1101
RS.SCPI1 = root.SCPI1.getlist()
RS.Output = root.bottWind.getstr()
return RS

def IDN(tkEvent):
ipAddy = tkEvent.widget.get()
print(f'IDN : {ipAddy}')
instr = jaVisa().jav_Open(ipAddy) #pylint:disable=E1101
instr.jav_Close()

def SYSTERR(tkEvent):
ipAddy = tkEvent.widget.get()
print(f'SYS Err : {ipAddy}')
instr = jaVisa().jav_Open(ipAddy) #pylint:disable=E1101
instr.jav_ClrErr()
print(f'SYS Err : No Error')
instr.jav_Close()

def SYSTNFO(tkEvent):
ipAddy = tkEvent.widget.get()
print(f'SYS INFO : {ipAddy}')
instr = jaVisa().jav_Open(ipAddy) #pylint:disable=E1101
instr.query('SYST:DFPR?')
instr.jav_Close()

def instr1(root):
Output = ""
RS = gui_reader(root)
Instr = jaVisa()
Instr.debug = 0
Instr.jav_Open(RS.IP1)
for scpi in RS.SCPI1:
if '?' in scpi:
rdStr = Instr.query(scpi)
Output = Output + ', ' + rdStr
else:
Instr.write(scpi)
Output = datetime.datetime.now().strftime("%y%m%d, %H:%M:%S.%f") + Output
print(Output)
f = open(__file__+'.txt', 'a')
f.write(Output+'\n')
f.close()
Instr.jav_Close()

###############################################################################
### GUI Main
###############################################################################
def main():
root = theme().addColor()
root.title('Rohde & Schwarz Options')
root.resizable(0, 0)

###########################################################################
### guiBlox: Create Widgets
###########################################################################
root.entryCol1 = entryCol(root, {'Instr': '10.0.0.10'})
root.SCPI1 = listWindow(root).writeN('*IDN?\n*OPT?\nSYST:DFPR?\n')

root.bottWind = listWindow(root)
root.bottWind.stdOut() #Stdout --> window
root.btnRowTop = buttonRow(root, 1, makequit=0) #pylint: disable=unused-variable
root.btnRowBot = buttonRow(root, 3) #pylint: disable=unused-variable
clrBottom(root)

###########################################################################
### guiBlox: Customize Widgets
###########################################################################
root.entryCol1.entry0.bind("<Double-Button-1>", IDN) #pylint: disable=E1101
root.entryCol1.entry0.bind("<Button-3>", SYSTERR) #pylint: disable=E1101
root.entryCol1.entry0.bind("<Double-Button-3>", SYSTNFO) #pylint: disable=E1101

root.SCPI1.listWindow.config(width=SCPIWidth, height=5)

root.bottWind.listWindow.config(height= 15, width=(SCPIWidth))
root.btnRowTop.button0.config(text='Query', command=lambda: instr1(root)) #pylint: disable=E1101

root.btnRowBot.button0.config(text='write File', command=lambda: fwrite(root)) #pylint: disable=E1101
root.btnRowBot.button1.config(text='open File', command=lambda: fopen()) #pylint: disable=E1101
root.btnRowBot.button2.config(text='clear', command=lambda: clrBottom(root))#pylint: disable=E1101

###########################################################################
### guiBlox: Place Widgets
###########################################################################
root.grid_rowconfigure(2, weight=1)
root.entryCol1.frame.grid(row=0, column=0, sticky="ns")
root.SCPI1.frame.grid(row=1, column=0, sticky='ew')
root.btnRowTop.frame.grid(row=2, column=0, columnspan=2, sticky="nsew")
root.bottWind.frame.grid(row=3, column=0, columnspan=2, sticky='nsew')
root.btnRowBot.frame.grid(row=10, column=0, columnspan=2, sticky="nsew")

root.mainloop()

if __name__ == '__main__':
main()
14 changes: 6 additions & 8 deletions projects/VSA_VSG_Sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#####################################################################
### User Inputs
#####################################################################
entryDict = {}
entryDict = {}
entryDict['SMW IP'] = '192.168.1.114'
entryDict['FSW IP'] = '192.168.1.109'
entryDict['Freq Start'] = '24e9'
Expand All @@ -17,15 +17,13 @@
entryDict['Filename'] = 'Output'

#####################################################################
### OOGUI Import
### OOGUI Import
#####################################################################
import time
import os
from guiblox import buttonRow, entryCol, theme, listWindow

### Code specific imports
from rssd.VST.Common import VST #pylint:disable=E0611,E0401
from rssd.FileIO import FileIO
import time
import os

#####################################################################
### Function Definition
Expand All @@ -35,7 +33,7 @@ def IDN(root):
print(Instr.SMW.query('*IDN?'))
print(Instr.FSW.query('*IDN?'))
Instr.jav_Close()

def run(root):
Instr = VST().jav_Open(root.entryCol.entry0.get(),root.entryCol.entry1.get()) #pylint:disable=E1101
OFileCSV = FileIO().makeFile(root.entryCol.entry7.get()+'csv')
Expand Down Expand Up @@ -108,4 +106,4 @@ def main():
root.mainloop()

if __name__ == '__main__':
main()
main()
2 changes: 1 addition & 1 deletion projects/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def main():
print('Hello World')

if __name__ == '__main__':
main()
main()
6 changes: 3 additions & 3 deletions projects/helloworld_tkinter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from tkinter import *
from tkinter import Tk

def main():
window = Tk()
window.title("Hello World")
window.title("Hello World")
window.mainloop()

if __name__ == '__main__':
main()
main()

0 comments on commit 9ccdfe4

Please sign in to comment.