sia_tp_sample / Billwilliams1952__PiCameraApp.jsonl
shahp7575's picture
commit files to HF hub
3a7f06a
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/BasicControls.py","language":"python","identifier":"BasicControls.BuildPage","parameters":"( self )","argument_list":"","return_statement":"","docstring":"Add additional controls if JPG is selected\n\t\t\t\tCertain file formats accept additional options which can be specified as keyword\n\t\t\t\targuments. Currently, only the 'jpeg' encoder accepts additional options, which are:\n\n\t\t\t\tquality - Defines the quality of the JPEG encoder as an integer ranging from 1 to 100.\n\t\t\t\t\t\t\t Defaults to 85. Please note that JPEG quality is not a percentage and\n\t\t\t\t\t\t\t definitions of quality vary widely.\n\t\t\t\trestart - Defines the restart interval for the JPEG encoder as a number of JPEG MCUs.\n\t\t\t\t\t\t\t The actual restart interval used will be a multiple of the number of MCUs per row in the resulting image.\n\t\t\t\tthumbnail - Defines the size and quality of the thumbnail to embed in the Exif\n\t\t\t\t\t\t\t\tmetadata. Specifying None disables thumbnail generation. Otherwise,\n\t\t\t\t\t\t\t\tspecify a tuple of (width, height, quality). Defaults to (64, 48, 35).\n\t\t\t\tbayer - If True, the raw bayer data from the camera\u2019s sensor is included in the\n\t\t\t\t\t\t\tExif metadata.","docstring_summary":"Add additional controls if JPG is selected\n\t\t\t\tCertain file formats accept additional options which can be specified as keyword\n\t\t\t\targuments. Currently, only the 'jpeg' encoder accepts additional options, which are:","docstring_tokens":["Add","additional","controls","if","JPG","is","selected","Certain","file","formats","accept","additional","options","which","can","be","specified","as","keyword","arguments",".","Currently","only","the","jpeg","encoder","accepts","additional","options","which","are",":"],"function":"def BuildPage ( self ):\n\t\t#### TODO: \tAdd Rotation. Cleanup and organize controls\n\t\t#\t\t\tAdd handling of Image Effect Params\n\n\t\t#----------- Select port for image captures ------------\n\t\tf1 = MyLabelFrame(self,'Select port for image captures',0,0,span=2)\n\t\tself.UseVidPort = MyBooleanVar(False)\n\t\tself.UseRadio = MyRadio(f1,'Use Still Port',False,self.UseVidPort,\n\t\t\t\t\tself.UseVideoPort,0,0,'W',tip=100)\n\t\tMyRadio(f1,'Use Video Port',True,self.UseVidPort,\n\t\t\t\t\tself.UseVideoPort,0,1,'W',tip=101)\n\t\tf2 = ttk.Frame(f1)\t\t\t# Sub frame\n\t\tf2.grid(row=1,column=0,columnspan=4,sticky='NSEW')\n\t\tself.VideoDenoise = MyBooleanVar(True)\n\t\tb = ttk.Checkbutton(f2,text='Video denoise',variable=self.VideoDenoise,\n\t\t\tcommand=self.VideoDenoiseChecked)\n\t\tb.grid(row=1,column=0,sticky='NW',padx=5)\n\t\tToolTip(b,msg=103)\n\t\tself.VideoStab = MyBooleanVar(False)\n\t\tb = ttk.Checkbutton(f2,text='Video stabilization',variable=self.VideoStab,\n\t\t\tcommand=self.VideoStabChecked)\n\t\tb.grid(row=1,column=1,sticky='NW')\n\t\tToolTip(b, msg=105)\n\t\tself.ImageDenoise = MyBooleanVar(True)\n\t\tb = ttk.Checkbutton(f2,text='Image denoise',variable=self.ImageDenoise,\n\t\t\tcommand=self.ImageDenoiseChecked)\n\t\tb.grid(row=1,column=2,sticky='NW',padx=10)\n\t\tToolTip(b, msg=104)\n\n\t\t#--------------- Picture\/Video Capture Size ---------------\n\t\tf = MyLabelFrame(self,'Picture\/Video capture size in pixels',1,0)\n\t\t#f.columnconfigure(0,weight=1)\n\t\tf1 = ttk.Frame(f)\t\t\t# Sub frames to frame f\n\t\tf1.grid(row=1,column=0,sticky='NSEW')\n\t\tf1.columnconfigure(1,weight=1)\n\t\tself.UseFixedResolutions = BooleanVar()\n\t\tself.UseFixedResolutions.set(True)\n\t\tself.UseFixedResRadio = ttk.Radiobutton(f1,text='Use fixed:',\n\t\t\tvariable=self.UseFixedResolutions,\n\t\t\tvalue=True,command=self.UseFixedResRadios,padding=(5,5,5,5))\n\t\tToolTip(self.UseFixedResRadio,120)\n\t\tself.UseFixedResRadio.grid(row=0,column=0,sticky='NW')\n\t\tself.FixedResolutionsCombo = Combobox(f1,state='readonly',width=25)\n\t\tself.FixedResolutionsCombo.bind('<<ComboboxSelected>>',\n\t\t\tself.FixedResolutionChanged)\n\t\tself.FixedResolutionsCombo.grid(row=0,column=1,columnspan=3,sticky='W')\n\t\tToolTip(self.FixedResolutionsCombo,121)\n\t\t#------------ Capture Width and Height ----------------\n\t\t# OrderedDict is used to ensure the keys stay in the same order as\n\t\t# entered. I want the combobox to display in this order\n\t\t#### TODO: \tMust check resolution and framerate and disable the Video\n\t\t# \t\t\tbutton if we exceed limits of the modes\n\t\t# Framerate 1-30 fps up to 1920x1080\t\t16:9 aspect ratio\n\t\t# Framerate 1-15 fps up to 2592 x 1944\t\t 4:3 aspect ratio\n\t\t# Framerate 0.1666 to 1 fps up to 2592 x 1944 4:3 aspect ratio\n\t\t# Framerate 1-42 fps up t0 1296 x 972 \t\t 4:3 aspect ratio\n\t\t# Framerate 1-49 fps up to 1296 x 730\t\t16:9 aspect ratio\n\t\t# Framerate 42.1 - 60 fps to 640 x 480\t\t 4:3 aspect ratio\n\t\t# Framerate 60.1 - 90 fps to 640 x 480\t\t 4:3 aspect ratio\n\t\tself.StandardResolutions = OrderedDict([ \\\n\t\t\t('CGA', (320,200)),\t\t\t('QVGA', (320,240)),\n\t\t\t('VGA', (640,480)),\t\t\t('PAL', (768,576)),\n\t\t\t('480p', (720,480)),\t\t('576p', (720,576)),\n\t\t\t('WVGA', (800,480)),\t\t('SVGA', (800,600)),\n\t\t\t('FWVGA', (854,480)),\t\t('WSVGA', (1024,600)),\n\t\t\t('XGA', (1024,768)),\t\t('HD 720', (1280,720)),\n\t\t\t('WXGA_1', (1280,768)),\t\t('WXGA_2', (1280,800)),\n\t\t\t('SXGA', (1280,1024)),\t\t('SXGA+', (1400,1050)),\n\t\t\t('UXGA', (1600,1200)),\t\t('WSXGA+', (1680,1050)),\n\t\t\t('HD 1080', (1920,1080)), \t('WUXGA', (1920,1200)),\n\t\t\t('2K', (2048,1080)),\t\t('QXGA', (2048, 1536)),\n\t\t\t('WQXGA', (2560,1600)),\t\t('MAX Resolution', (2592,1944)),\n\t\t ])\n\t\tvals = []\n\t\tfor key in self.StandardResolutions.keys():\n\t\t\tvals.append('%s: (%dx%d)' % (key, # Tabs not working?!!\n\t\t\t\t\t\t\tself.StandardResolutions[key][0],\n\t\t\t\t\t\t\tself.StandardResolutions[key][1]))\n\t\tself.FixedResolutionsCombo['values'] = vals\n\t\tself.FixedResolutionsCombo.current(10)\n\n\t\tf2 = ttk.Frame(f)\t\t# subframe to frame f\n\t\tf2.grid(row=2,column=0,sticky='NSEW')\n\t\tf2.columnconfigure(2,weight=1)\n\t\tf2.columnconfigure(4,weight=1)\n\t\tb2 = ttk.Radiobutton(f2,text='Roll your own:',\n\t\t\tvariable=self.UseFixedResolutions,\n\t\t\tvalue=False,command=self.UseFixedResRadios,padding=(5,5,5,5))\n\t\tb2.grid(row=1,column=0,sticky='NW')\n\t\tToolTip(b2,122)\n\n\t\tLabel(f2,text=\"Width:\",anchor=E).grid(column=1,row=1,sticky='E',ipadx=3,ipady=3)\n\t\tWidths = []\n\t\tfor i in range(1,82):\n\t\t\tWidths.append(32 * i) # Widths can be in 32 byte increments\n\t\tself.cb = MyComboBox ( f2, Widths, current=10,\n\t\t\tcallback=self.ResolutionChanged, width=5, row=1, col=2,\n\t\t\tsticky='W', state='disabled', tip=123)\n\n\t\tLabel(f2,text=\"Height:\",anchor=E).grid(column=3,row=1,sticky='W',ipadx=5,ipady=3)\n\t\tHeights = []\n\t\tfor i in range(1,123):\n\t\t\tHeights.append(16 * i)\t# heights in 16 byte increments\n\t\tself.cb1 = MyComboBox ( f2, Heights, current=10,\n\t\t\tcallback=self.ResolutionChanged, width=5, row=1, col=4,\n\t\t\tsticky='W', state='disabled', tip=124)\n\n\t\tttk.Label(f2,text='Actual:').grid(row=2,column=1,sticky='E')\n\t\tself.WidthLabel = ttk.Label(f2,style='DataLabel.TLabel')\n\t\tself.WidthLabel.grid(row=2,column=2,sticky='W')\n\t\tToolTip(self.WidthLabel,125)\n\t\tttk.Label(f2,text='Actual:').grid(row=2,column=3,sticky='E')\n\t\tself.HeightLabel = ttk.Label(f2,style='DataLabel.TLabel')\n\t\tself.HeightLabel.grid(row=2,column=4,sticky='W')\n\t\tToolTip(self.HeightLabel,126)\n\n\t\tSeparator(f,orient=HORIZONTAL).grid(pady=5,row=3,column=0,\n\t\t\tcolumnspan=4,sticky='EW')\n\n\t\t#--------------- Zoom Region Before ----------------\n\t\tf4 = MyLabelFrame(f,'Zoom region of interest before taking '+\n\t\t\t'picture\/video',4,0)\n\t\t#f4.columnconfigure(1,weight=1)\n\t\t#f4.columnconfigure(3,weight=1)\n\t\tLabel(f4,text='X:').grid(row=0,column=0,sticky='E')\n\t\tself.Xzoom = ttk.Scale(f4,from_=0.0,to=0.94,orient='horizontal')\n\t\tself.Xzoom.grid(row=0,column=1,sticky='W',padx=5,pady=3)\n\t\tself.Xzoom.set(0.0)\n\t\tToolTip(self.Xzoom,130)\n\t\tLabel(f4,text='Y:').grid(row=0,column=2,sticky='E')\n\t\tself.Yzoom = ttk.Scale(f4,from_=0.0,to=0.94,orient='horizontal')\n\t\tself.Yzoom.grid(row=0,column=3,sticky='W',padx=5,pady=3)\n\t\tself.Yzoom.set(0.0)\n\t\tToolTip(self.Yzoom,131)\n\t\tLabel(f4,text='Width:').grid(row=1,column=0,sticky='E')\n\t\tself.Widthzoom = ttk.Scale(f4,from_=0.05,to=1.0,orient='horizontal')\n\t\tself.Widthzoom.grid(row=1,column=1,sticky='W',padx=5,pady=3)\n\t\tself.Widthzoom.set(1.0)\n\t\tToolTip(self.Widthzoom,132)\n\t\tLabel(f4,text='Height:').grid(row=1,column=2,sticky='E')\n\t\tself.Heightzoom = ttk.Scale(f4,from_=0.05,to=1.0,orient='horizontal')\n\t\tself.Heightzoom.grid(row=1,column=3,sticky='W',padx=5,pady=3)\n\t\tself.Heightzoom.set(1.0)\n\t\tToolTip(self.Heightzoom,133)\n\t\t# WLW THIS IS A PROBLEM\n\t\timage = PIL.Image.open('Assets\/reset.png') #.resize((16,16))\n\t\tself.resetImage = GetPhotoImage(image.resize((16,16)))\n\t\tself.ResetZoomButton = ttk.Button(f4,image=self.resetImage,\n\t\t\tcommand=self.ZoomReset)\n\t\tself.ResetZoomButton.grid(row=0,column=4,rowspan=2,sticky='W')\n\t\tToolTip(self.ResetZoomButton,134)\n\n\t\tself.Xzoom.config(command=lambda newval,\n\t\t\twidget=self.Xzoom:self.Zoom(newval,widget))\n\t\tself.Yzoom.config(command=lambda newval,\n\t\t\twidget=self.Yzoom:self.Zoom(newval,widget))\n\t\tself.Widthzoom.config(command=lambda newval,\n\t\t\twidget=self.Widthzoom:self.Zoom(newval,widget))\n\t\tself.Heightzoom.config(command=lambda newval,\n\t\t\twidget=self.Heightzoom:self.Zoom(newval,widget))\n\n\t\tSeparator(f,orient=HORIZONTAL).grid(pady=5,row=5,column=0,\n\t\t\tcolumnspan=3,sticky='EW')\n\n\t\t#--------------- Resize Image After ----------------\n\t\tf4 = MyLabelFrame(f,'Resize image after taking picture\/video',6,0)\n\t\t#f4.columnconfigure(3,weight=1)\n\t\t#f4.columnconfigure(5,weight=1)\n\n\t\tb = MyBooleanVar(False)\n\t\tself.ResizeAfterNone = MyRadio(f4,'None (Default)',False,b,\n\t\t\tself.AllowImageResizeAfter,0,0,'W',pad=(0,5,0,5), tip=140)\n\t\tMyRadio(f4,'Resize',True,b,self.AllowImageResizeAfter,\n\t\t\t\t\t0,1,'W',pad=(5,5,0,5),tip=141)\n\n\t\tLabel(f4,text=\"Width:\",anchor=E).grid(column=2,row=0,sticky='E',ipadx=3,ipady=3)\n\t\tself.resizeWidthAfterCombo = MyComboBox ( f4, Widths, current=10,\n\t\t\tcallback=self.ResizeAfterChanged, width=5, row=0, col=3,\n\t\t\tsticky='W', state='disabled', tip=142)\n\n\t\tLabel(f4,text=\"Height:\",anchor=E).grid(column=4,row=0,sticky='W',ipadx=5,ipady=3)\n\t\tself.resizeHeightAfterCombo = MyComboBox ( f4, Heights, current=10,\n\t\t\tcallback=self.ResizeAfterChanged, width=5, row=0, col=5,\n\t\t\tsticky='W', state='disabled', tip=143)\n\n\t\tself.resizeAfter = None\n\n\t\t#--------------- Quick Adjustments ----------------\n\t\tf = MyLabelFrame(self,'Quick adjustments',2,0)\n\t\t#f.columnconfigure(2,weight=1)\n\t\t#-Brightness\n\t\tself.brightLabel, self.brightness, val = \\\n\t\t\tself.SetupLabelCombo(f,'Brightness:',0,0,0, 100,\n\t\t\t\tself.CameraBrightnessChanged, self.camera.brightness )\n\t\tself.CameraBrightnessChanged(val)\n\t\tToolTip(self.brightness,msg=150)\n\t\t#-Contrast\n\t\tself.contrastLabel, self.contrast, val = \\\n\t\t\tself.SetupLabelCombo(f,'Contrast:',0,3,-100, 100,\n\t\t\t\tself.ContrastChanged, self.camera.contrast )\n\t\tself.ContrastChanged(val)\n\t\tToolTip(self.contrast,msg=151)\n\t\t#-Saturation\n\t\tself.saturationLabel, self.saturation, val = \\\n\t\t\tself.SetupLabelCombo(f,'Saturation:',1,0,-100, 100,\n\t\t\t\tself.SaturationChanged, self.camera.saturation, label='Sat' )\n\t\tself.SaturationChanged(val)\n\t\tToolTip(self.saturation,msg=152)\n\t\t#-Sharpness\n\t\tself.sharpnessLabel, self.sharpness, val = \\\n\t\t\tself.SetupLabelCombo(f,'Sharpness:',1,3,-100, 100,\n\t\t\t\tself.SharpnessChanged, self.camera.sharpness )\n\t\tself.SharpnessChanged(val)\n\t\tToolTip(self.sharpness,msg=153)\n\t\t#-Reset\n\t\t#self.ResetGeneralButton = Button(f,image=self.resetImage,width=5,\n\t\t\t#command=self.ResetGeneralSliders)\n\t\t#self.ResetGeneralButton.grid(row=4,column=2,sticky='W',padx=5)\n\t\t#ToolTip(self.ResetGeneralButton,msg=154)\n\n\t\t#--------------- Image Effects ----------------\n\t\tf = MyLabelFrame(self,'Preprogrammed image effects',3,0)\n\t\t#f.columnconfigure(2,weight=1)\n\n\t\tv = MyBooleanVar(False)\n\t\tself.NoEffectsRadio = MyRadio(f,'None (Default)',False,v,\n\t\t\tself.EffectsChecked,0,0,'W',tip=160)\n\t\tMyRadio(f,'Select effect:',True,v,self.EffectsChecked,0,1,'W',\n\t\t\ttip=161)\n\n\t\tself.effects = Combobox(f,height=15,width=10,state='readonly')#,width=15)\n\t\tself.effects.grid(row=0,column=2,sticky='W')\n\t\teffects = list(self.camera.IMAGE_EFFECTS.keys())\t# python 3 workaround\n\t\teffects.remove('none')\n\t\teffects.sort() #cmp=lambda x,y: cmp(x.lower(),y.lower())) # not python 3\n\t\tself.effects['values'] = effects\n\t\tself.effects.current(0)\n\t\tself.effects.bind('<<ComboboxSelected>>',self.EffectsChanged)\n\t\tToolTip(self.effects, msg=162)\n\n\t\tself.ModParams = ttk.Button(f,text='Params...',\n\t\t\tcommand=self.ModifyEffectsParamsPressed,underline=0,padding=(5,3,5,3),width=8)\n\t\tself.ModParams.grid(row=0,column=3,sticky=EW,padx=5)\n\t\tToolTip(self.ModParams, msg=163)\n\t\tself.EffectsChecked(False)\n\t\t'''\n\t\t\t\tAdd additional controls if JPG is selected\n\t\t\t\tCertain file formats accept additional options which can be specified as keyword\n\t\t\t\targuments. Currently, only the 'jpeg' encoder accepts additional options, which are:\n\n\t\t\t\tquality - Defines the quality of the JPEG encoder as an integer ranging from 1 to 100.\n\t\t\t\t\t\t\t Defaults to 85. Please note that JPEG quality is not a percentage and\n\t\t\t\t\t\t\t definitions of quality vary widely.\n\t\t\t\trestart - Defines the restart interval for the JPEG encoder as a number of JPEG MCUs.\n\t\t\t\t\t\t\t The actual restart interval used will be a multiple of the number of MCUs per row in the resulting image.\n\t\t\t\tthumbnail - Defines the size and quality of the thumbnail to embed in the Exif\n\t\t\t\t\t\t\t\tmetadata. Specifying None disables thumbnail generation. Otherwise,\n\t\t\t\t\t\t\t\tspecify a tuple of (width, height, quality). Defaults to (64, 48, 35).\n\t\t\t\tbayer - If True, the raw bayer data from the camera\u2019s sensor is included in the\n\t\t\t\t\t\t\tExif metadata.\n\t\t'''\n\t\t#--------------- Flash Mode ---------------\n\t\tf = MyLabelFrame(self,'LED and Flash mode',4,0,span=4)\n\t\t#f.columnconfigure(3,weight=1)\n\t\tself.LedOn = MyBooleanVar(True)\n\t\tself.LedButton = ttk.Checkbutton(f,text='Led On (via GPIO pins)',\n\t\t\tvariable=self.LedOn, command=self.LedOnChecked)\n\t\tself.LedButton.grid(row=0,column=0,sticky='NW',pady=5, columnspan=2)\n\t\tToolTip(self.LedButton,msg=102)\n\t\tLabel(f,text='Flash Mode:').grid(row=1,column=0,sticky='W')\n\t\tb = MyStringVar('off')\n\t\tself.FlashModeOffRadio = MyRadio(f,'Off (Default)','off',b,\n\t\t\tself.FlashModeButton,1,1,'W',tip=180)\n\t\tMyRadio(f,'Auto','auto',b,self.FlashModeButton,1,2,'W',tip=181)\n\t\tMyRadio(f,'Select:','set',b,self.FlashModeButton,1,3,'W',tip=182)\n\t\t# Use invoke() on radio button to force a command\n\t\tself.FlashModeCombo = Combobox(f,state='readonly',width=10)\n\t\tself.FlashModeCombo.grid(row=1,column=4,sticky='W')\n\t\tself.FlashModeCombo.bind('<<ComboboxSelected>>',self.FlashModeChanged)\n\t\tmodes = list(self.camera.FLASH_MODES.keys())\n\t\tmodes.remove('off')\t\t# these two are handled by radio buttons\n\t\tmodes.remove('auto')\n\t\tmodes.sort() #cmp=lambda x,y: cmp(x.lower(),y.lower()))\n\t\tself.FlashModeCombo['values'] = modes\n\t\tself.FlashModeCombo.current(0)\n\t\tself.FlashModeCombo.config(state='disabled')\n\t\tToolTip(self.FlashModeCombo,183)\n\n\t\tself.FixedResolutionChanged(None)","function_tokens":["def","BuildPage","(","self",")",":","#### TODO: \tAdd Rotation. Cleanup and organize controls","#\t\t\tAdd handling of Image Effect Params","#----------- Select port for image captures ------------","f1","=","MyLabelFrame","(","self",",","'Select port for image captures'",",","0",",","0",",","span","=","2",")","self",".","UseVidPort","=","MyBooleanVar","(","False",")","self",".","UseRadio","=","MyRadio","(","f1",",","'Use Still Port'",",","False",",","self",".","UseVidPort",",","self",".","UseVideoPort",",","0",",","0",",","'W'",",","tip","=","100",")","MyRadio","(","f1",",","'Use Video Port'",",","True",",","self",".","UseVidPort",",","self",".","UseVideoPort",",","0",",","1",",","'W'",",","tip","=","101",")","f2","=","ttk",".","Frame","(","f1",")","# Sub frame","f2",".","grid","(","row","=","1",",","column","=","0",",","columnspan","=","4",",","sticky","=","'NSEW'",")","self",".","VideoDenoise","=","MyBooleanVar","(","True",")","b","=","ttk",".","Checkbutton","(","f2",",","text","=","'Video denoise'",",","variable","=","self",".","VideoDenoise",",","command","=","self",".","VideoDenoiseChecked",")","b",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'NW'",",","padx","=","5",")","ToolTip","(","b",",","msg","=","103",")","self",".","VideoStab","=","MyBooleanVar","(","False",")","b","=","ttk",".","Checkbutton","(","f2",",","text","=","'Video stabilization'",",","variable","=","self",".","VideoStab",",","command","=","self",".","VideoStabChecked",")","b",".","grid","(","row","=","1",",","column","=","1",",","sticky","=","'NW'",")","ToolTip","(","b",",","msg","=","105",")","self",".","ImageDenoise","=","MyBooleanVar","(","True",")","b","=","ttk",".","Checkbutton","(","f2",",","text","=","'Image denoise'",",","variable","=","self",".","ImageDenoise",",","command","=","self",".","ImageDenoiseChecked",")","b",".","grid","(","row","=","1",",","column","=","2",",","sticky","=","'NW'",",","padx","=","10",")","ToolTip","(","b",",","msg","=","104",")","#--------------- Picture\/Video Capture Size ---------------","f","=","MyLabelFrame","(","self",",","'Picture\/Video capture size in pixels'",",","1",",","0",")","#f.columnconfigure(0,weight=1)","f1","=","ttk",".","Frame","(","f",")","# Sub frames to frame f","f1",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'NSEW'",")","f1",".","columnconfigure","(","1",",","weight","=","1",")","self",".","UseFixedResolutions","=","BooleanVar","(",")","self",".","UseFixedResolutions",".","set","(","True",")","self",".","UseFixedResRadio","=","ttk",".","Radiobutton","(","f1",",","text","=","'Use fixed:'",",","variable","=","self",".","UseFixedResolutions",",","value","=","True",",","command","=","self",".","UseFixedResRadios",",","padding","=","(","5",",","5",",","5",",","5",")",")","ToolTip","(","self",".","UseFixedResRadio",",","120",")","self",".","UseFixedResRadio",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'NW'",")","self",".","FixedResolutionsCombo","=","Combobox","(","f1",",","state","=","'readonly'",",","width","=","25",")","self",".","FixedResolutionsCombo",".","bind","(","'<<ComboboxSelected>>'",",","self",".","FixedResolutionChanged",")","self",".","FixedResolutionsCombo",".","grid","(","row","=","0",",","column","=","1",",","columnspan","=","3",",","sticky","=","'W'",")","ToolTip","(","self",".","FixedResolutionsCombo",",","121",")","#------------ Capture Width and Height ----------------","# OrderedDict is used to ensure the keys stay in the same order as","# entered. I want the combobox to display in this order","#### TODO: \tMust check resolution and framerate and disable the Video","# \t\t\tbutton if we exceed limits of the modes","# Framerate 1-30 fps up to 1920x1080\t\t16:9 aspect ratio","# Framerate 1-15 fps up to 2592 x 1944\t\t 4:3 aspect ratio","# Framerate 0.1666 to 1 fps up to 2592 x 1944 4:3 aspect ratio","# Framerate 1-42 fps up t0 1296 x 972 \t\t 4:3 aspect ratio","# Framerate 1-49 fps up to 1296 x 730\t\t16:9 aspect ratio","# Framerate 42.1 - 60 fps to 640 x 480\t\t 4:3 aspect ratio","# Framerate 60.1 - 90 fps to 640 x 480\t\t 4:3 aspect ratio","self",".","StandardResolutions","=","OrderedDict","(","[","(","'CGA'",",","(","320",",","200",")",")",",","(","'QVGA'",",","(","320",",","240",")",")",",","(","'VGA'",",","(","640",",","480",")",")",",","(","'PAL'",",","(","768",",","576",")",")",",","(","'480p'",",","(","720",",","480",")",")",",","(","'576p'",",","(","720",",","576",")",")",",","(","'WVGA'",",","(","800",",","480",")",")",",","(","'SVGA'",",","(","800",",","600",")",")",",","(","'FWVGA'",",","(","854",",","480",")",")",",","(","'WSVGA'",",","(","1024",",","600",")",")",",","(","'XGA'",",","(","1024",",","768",")",")",",","(","'HD 720'",",","(","1280",",","720",")",")",",","(","'WXGA_1'",",","(","1280",",","768",")",")",",","(","'WXGA_2'",",","(","1280",",","800",")",")",",","(","'SXGA'",",","(","1280",",","1024",")",")",",","(","'SXGA+'",",","(","1400",",","1050",")",")",",","(","'UXGA'",",","(","1600",",","1200",")",")",",","(","'WSXGA+'",",","(","1680",",","1050",")",")",",","(","'HD 1080'",",","(","1920",",","1080",")",")",",","(","'WUXGA'",",","(","1920",",","1200",")",")",",","(","'2K'",",","(","2048",",","1080",")",")",",","(","'QXGA'",",","(","2048",",","1536",")",")",",","(","'WQXGA'",",","(","2560",",","1600",")",")",",","(","'MAX Resolution'",",","(","2592",",","1944",")",")",",","]",")","vals","=","[","]","for","key","in","self",".","StandardResolutions",".","keys","(",")",":","vals",".","append","(","'%s: (%dx%d)'","%","(","key",",","# Tabs not working?!!","self",".","StandardResolutions","[","key","]","[","0","]",",","self",".","StandardResolutions","[","key","]","[","1","]",")",")","self",".","FixedResolutionsCombo","[","'values'","]","=","vals","self",".","FixedResolutionsCombo",".","current","(","10",")","f2","=","ttk",".","Frame","(","f",")","# subframe to frame f","f2",".","grid","(","row","=","2",",","column","=","0",",","sticky","=","'NSEW'",")","f2",".","columnconfigure","(","2",",","weight","=","1",")","f2",".","columnconfigure","(","4",",","weight","=","1",")","b2","=","ttk",".","Radiobutton","(","f2",",","text","=","'Roll your own:'",",","variable","=","self",".","UseFixedResolutions",",","value","=","False",",","command","=","self",".","UseFixedResRadios",",","padding","=","(","5",",","5",",","5",",","5",")",")","b2",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'NW'",")","ToolTip","(","b2",",","122",")","Label","(","f2",",","text","=","\"Width:\"",",","anchor","=","E",")",".","grid","(","column","=","1",",","row","=","1",",","sticky","=","'E'",",","ipadx","=","3",",","ipady","=","3",")","Widths","=","[","]","for","i","in","range","(","1",",","82",")",":","Widths",".","append","(","32","*","i",")","# Widths can be in 32 byte increments","self",".","cb","=","MyComboBox","(","f2",",","Widths",",","current","=","10",",","callback","=","self",".","ResolutionChanged",",","width","=","5",",","row","=","1",",","col","=","2",",","sticky","=","'W'",",","state","=","'disabled'",",","tip","=","123",")","Label","(","f2",",","text","=","\"Height:\"",",","anchor","=","E",")",".","grid","(","column","=","3",",","row","=","1",",","sticky","=","'W'",",","ipadx","=","5",",","ipady","=","3",")","Heights","=","[","]","for","i","in","range","(","1",",","123",")",":","Heights",".","append","(","16","*","i",")","# heights in 16 byte increments","self",".","cb1","=","MyComboBox","(","f2",",","Heights",",","current","=","10",",","callback","=","self",".","ResolutionChanged",",","width","=","5",",","row","=","1",",","col","=","4",",","sticky","=","'W'",",","state","=","'disabled'",",","tip","=","124",")","ttk",".","Label","(","f2",",","text","=","'Actual:'",")",".","grid","(","row","=","2",",","column","=","1",",","sticky","=","'E'",")","self",".","WidthLabel","=","ttk",".","Label","(","f2",",","style","=","'DataLabel.TLabel'",")","self",".","WidthLabel",".","grid","(","row","=","2",",","column","=","2",",","sticky","=","'W'",")","ToolTip","(","self",".","WidthLabel",",","125",")","ttk",".","Label","(","f2",",","text","=","'Actual:'",")",".","grid","(","row","=","2",",","column","=","3",",","sticky","=","'E'",")","self",".","HeightLabel","=","ttk",".","Label","(","f2",",","style","=","'DataLabel.TLabel'",")","self",".","HeightLabel",".","grid","(","row","=","2",",","column","=","4",",","sticky","=","'W'",")","ToolTip","(","self",".","HeightLabel",",","126",")","Separator","(","f",",","orient","=","HORIZONTAL",")",".","grid","(","pady","=","5",",","row","=","3",",","column","=","0",",","columnspan","=","4",",","sticky","=","'EW'",")","#--------------- Zoom Region Before ----------------","f4","=","MyLabelFrame","(","f",",","'Zoom region of interest before taking '","+","'picture\/video'",",","4",",","0",")","#f4.columnconfigure(1,weight=1)","#f4.columnconfigure(3,weight=1)","Label","(","f4",",","text","=","'X:'",")",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'E'",")","self",".","Xzoom","=","ttk",".","Scale","(","f4",",","from_","=","0.0",",","to","=","0.94",",","orient","=","'horizontal'",")","self",".","Xzoom",".","grid","(","row","=","0",",","column","=","1",",","sticky","=","'W'",",","padx","=","5",",","pady","=","3",")","self",".","Xzoom",".","set","(","0.0",")","ToolTip","(","self",".","Xzoom",",","130",")","Label","(","f4",",","text","=","'Y:'",")",".","grid","(","row","=","0",",","column","=","2",",","sticky","=","'E'",")","self",".","Yzoom","=","ttk",".","Scale","(","f4",",","from_","=","0.0",",","to","=","0.94",",","orient","=","'horizontal'",")","self",".","Yzoom",".","grid","(","row","=","0",",","column","=","3",",","sticky","=","'W'",",","padx","=","5",",","pady","=","3",")","self",".","Yzoom",".","set","(","0.0",")","ToolTip","(","self",".","Yzoom",",","131",")","Label","(","f4",",","text","=","'Width:'",")",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'E'",")","self",".","Widthzoom","=","ttk",".","Scale","(","f4",",","from_","=","0.05",",","to","=","1.0",",","orient","=","'horizontal'",")","self",".","Widthzoom",".","grid","(","row","=","1",",","column","=","1",",","sticky","=","'W'",",","padx","=","5",",","pady","=","3",")","self",".","Widthzoom",".","set","(","1.0",")","ToolTip","(","self",".","Widthzoom",",","132",")","Label","(","f4",",","text","=","'Height:'",")",".","grid","(","row","=","1",",","column","=","2",",","sticky","=","'E'",")","self",".","Heightzoom","=","ttk",".","Scale","(","f4",",","from_","=","0.05",",","to","=","1.0",",","orient","=","'horizontal'",")","self",".","Heightzoom",".","grid","(","row","=","1",",","column","=","3",",","sticky","=","'W'",",","padx","=","5",",","pady","=","3",")","self",".","Heightzoom",".","set","(","1.0",")","ToolTip","(","self",".","Heightzoom",",","133",")","# WLW THIS IS A PROBLEM","image","=","PIL",".","Image",".","open","(","'Assets\/reset.png'",")","#.resize((16,16))","self",".","resetImage","=","GetPhotoImage","(","image",".","resize","(","(","16",",","16",")",")",")","self",".","ResetZoomButton","=","ttk",".","Button","(","f4",",","image","=","self",".","resetImage",",","command","=","self",".","ZoomReset",")","self",".","ResetZoomButton",".","grid","(","row","=","0",",","column","=","4",",","rowspan","=","2",",","sticky","=","'W'",")","ToolTip","(","self",".","ResetZoomButton",",","134",")","self",".","Xzoom",".","config","(","command","=","lambda","newval",",","widget","=","self",".","Xzoom",":","self",".","Zoom","(","newval",",","widget",")",")","self",".","Yzoom",".","config","(","command","=","lambda","newval",",","widget","=","self",".","Yzoom",":","self",".","Zoom","(","newval",",","widget",")",")","self",".","Widthzoom",".","config","(","command","=","lambda","newval",",","widget","=","self",".","Widthzoom",":","self",".","Zoom","(","newval",",","widget",")",")","self",".","Heightzoom",".","config","(","command","=","lambda","newval",",","widget","=","self",".","Heightzoom",":","self",".","Zoom","(","newval",",","widget",")",")","Separator","(","f",",","orient","=","HORIZONTAL",")",".","grid","(","pady","=","5",",","row","=","5",",","column","=","0",",","columnspan","=","3",",","sticky","=","'EW'",")","#--------------- Resize Image After ----------------","f4","=","MyLabelFrame","(","f",",","'Resize image after taking picture\/video'",",","6",",","0",")","#f4.columnconfigure(3,weight=1)","#f4.columnconfigure(5,weight=1)","b","=","MyBooleanVar","(","False",")","self",".","ResizeAfterNone","=","MyRadio","(","f4",",","'None (Default)'",",","False",",","b",",","self",".","AllowImageResizeAfter",",","0",",","0",",","'W'",",","pad","=","(","0",",","5",",","0",",","5",")",",","tip","=","140",")","MyRadio","(","f4",",","'Resize'",",","True",",","b",",","self",".","AllowImageResizeAfter",",","0",",","1",",","'W'",",","pad","=","(","5",",","5",",","0",",","5",")",",","tip","=","141",")","Label","(","f4",",","text","=","\"Width:\"",",","anchor","=","E",")",".","grid","(","column","=","2",",","row","=","0",",","sticky","=","'E'",",","ipadx","=","3",",","ipady","=","3",")","self",".","resizeWidthAfterCombo","=","MyComboBox","(","f4",",","Widths",",","current","=","10",",","callback","=","self",".","ResizeAfterChanged",",","width","=","5",",","row","=","0",",","col","=","3",",","sticky","=","'W'",",","state","=","'disabled'",",","tip","=","142",")","Label","(","f4",",","text","=","\"Height:\"",",","anchor","=","E",")",".","grid","(","column","=","4",",","row","=","0",",","sticky","=","'W'",",","ipadx","=","5",",","ipady","=","3",")","self",".","resizeHeightAfterCombo","=","MyComboBox","(","f4",",","Heights",",","current","=","10",",","callback","=","self",".","ResizeAfterChanged",",","width","=","5",",","row","=","0",",","col","=","5",",","sticky","=","'W'",",","state","=","'disabled'",",","tip","=","143",")","self",".","resizeAfter","=","None","#--------------- Quick Adjustments ----------------","f","=","MyLabelFrame","(","self",",","'Quick adjustments'",",","2",",","0",")","#f.columnconfigure(2,weight=1)","#-Brightness","self",".","brightLabel",",","self",".","brightness",",","val","=","self",".","SetupLabelCombo","(","f",",","'Brightness:'",",","0",",","0",",","0",",","100",",","self",".","CameraBrightnessChanged",",","self",".","camera",".","brightness",")","self",".","CameraBrightnessChanged","(","val",")","ToolTip","(","self",".","brightness",",","msg","=","150",")","#-Contrast","self",".","contrastLabel",",","self",".","contrast",",","val","=","self",".","SetupLabelCombo","(","f",",","'Contrast:'",",","0",",","3",",","-","100",",","100",",","self",".","ContrastChanged",",","self",".","camera",".","contrast",")","self",".","ContrastChanged","(","val",")","ToolTip","(","self",".","contrast",",","msg","=","151",")","#-Saturation","self",".","saturationLabel",",","self",".","saturation",",","val","=","self",".","SetupLabelCombo","(","f",",","'Saturation:'",",","1",",","0",",","-","100",",","100",",","self",".","SaturationChanged",",","self",".","camera",".","saturation",",","label","=","'Sat'",")","self",".","SaturationChanged","(","val",")","ToolTip","(","self",".","saturation",",","msg","=","152",")","#-Sharpness","self",".","sharpnessLabel",",","self",".","sharpness",",","val","=","self",".","SetupLabelCombo","(","f",",","'Sharpness:'",",","1",",","3",",","-","100",",","100",",","self",".","SharpnessChanged",",","self",".","camera",".","sharpness",")","self",".","SharpnessChanged","(","val",")","ToolTip","(","self",".","sharpness",",","msg","=","153",")","#-Reset","#self.ResetGeneralButton = Button(f,image=self.resetImage,width=5,","#command=self.ResetGeneralSliders)","#self.ResetGeneralButton.grid(row=4,column=2,sticky='W',padx=5)","#ToolTip(self.ResetGeneralButton,msg=154)","#--------------- Image Effects ----------------","f","=","MyLabelFrame","(","self",",","'Preprogrammed image effects'",",","3",",","0",")","#f.columnconfigure(2,weight=1)","v","=","MyBooleanVar","(","False",")","self",".","NoEffectsRadio","=","MyRadio","(","f",",","'None (Default)'",",","False",",","v",",","self",".","EffectsChecked",",","0",",","0",",","'W'",",","tip","=","160",")","MyRadio","(","f",",","'Select effect:'",",","True",",","v",",","self",".","EffectsChecked",",","0",",","1",",","'W'",",","tip","=","161",")","self",".","effects","=","Combobox","(","f",",","height","=","15",",","width","=","10",",","state","=","'readonly'",")","#,width=15)","self",".","effects",".","grid","(","row","=","0",",","column","=","2",",","sticky","=","'W'",")","effects","=","list","(","self",".","camera",".","IMAGE_EFFECTS",".","keys","(",")",")","# python 3 workaround","effects",".","remove","(","'none'",")","effects",".","sort","(",")","#cmp=lambda x,y: cmp(x.lower(),y.lower())) # not python 3","self",".","effects","[","'values'","]","=","effects","self",".","effects",".","current","(","0",")","self",".","effects",".","bind","(","'<<ComboboxSelected>>'",",","self",".","EffectsChanged",")","ToolTip","(","self",".","effects",",","msg","=","162",")","self",".","ModParams","=","ttk",".","Button","(","f",",","text","=","'Params...'",",","command","=","self",".","ModifyEffectsParamsPressed",",","underline","=","0",",","padding","=","(","5",",","3",",","5",",","3",")",",","width","=","8",")","self",".","ModParams",".","grid","(","row","=","0",",","column","=","3",",","sticky","=","EW",",","padx","=","5",")","ToolTip","(","self",".","ModParams",",","msg","=","163",")","self",".","EffectsChecked","(","False",")","#--------------- Flash Mode ---------------","f","=","MyLabelFrame","(","self",",","'LED and Flash mode'",",","4",",","0",",","span","=","4",")","#f.columnconfigure(3,weight=1)","self",".","LedOn","=","MyBooleanVar","(","True",")","self",".","LedButton","=","ttk",".","Checkbutton","(","f",",","text","=","'Led On (via GPIO pins)'",",","variable","=","self",".","LedOn",",","command","=","self",".","LedOnChecked",")","self",".","LedButton",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'NW'",",","pady","=","5",",","columnspan","=","2",")","ToolTip","(","self",".","LedButton",",","msg","=","102",")","Label","(","f",",","text","=","'Flash Mode:'",")",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'W'",")","b","=","MyStringVar","(","'off'",")","self",".","FlashModeOffRadio","=","MyRadio","(","f",",","'Off (Default)'",",","'off'",",","b",",","self",".","FlashModeButton",",","1",",","1",",","'W'",",","tip","=","180",")","MyRadio","(","f",",","'Auto'",",","'auto'",",","b",",","self",".","FlashModeButton",",","1",",","2",",","'W'",",","tip","=","181",")","MyRadio","(","f",",","'Select:'",",","'set'",",","b",",","self",".","FlashModeButton",",","1",",","3",",","'W'",",","tip","=","182",")","# Use invoke() on radio button to force a command","self",".","FlashModeCombo","=","Combobox","(","f",",","state","=","'readonly'",",","width","=","10",")","self",".","FlashModeCombo",".","grid","(","row","=","1",",","column","=","4",",","sticky","=","'W'",")","self",".","FlashModeCombo",".","bind","(","'<<ComboboxSelected>>'",",","self",".","FlashModeChanged",")","modes","=","list","(","self",".","camera",".","FLASH_MODES",".","keys","(",")",")","modes",".","remove","(","'off'",")","# these two are handled by radio buttons","modes",".","remove","(","'auto'",")","modes",".","sort","(",")","#cmp=lambda x,y: cmp(x.lower(),y.lower()))","self",".","FlashModeCombo","[","'values'","]","=","modes","self",".","FlashModeCombo",".","current","(","0",")","self",".","FlashModeCombo",".","config","(","state","=","'disabled'",")","ToolTip","(","self",".","FlashModeCombo",",","183",")","self",".","FixedResolutionChanged","(","None",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/BasicControls.py#L52-L340"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Exposure.py","language":"python","identifier":"Exposure.ValidateEntry","parameters":"( self, entry, minVal, maxVal )","argument_list":"","return_statement":"return num","docstring":"Change how the edit fields work. Allow a '\/' in the edit field to\n\t\tdenote a fraction.\n\t\tSplit on '\/' and evaluate each side. Note, if '<num> \/' then\n\t\tnum is evalulated since 'den' is empty","docstring_summary":"Change how the edit fields work. Allow a '\/' in the edit field to\n\t\tdenote a fraction.\n\t\tSplit on '\/' and evaluate each side. Note, if '<num> \/' then\n\t\tnum is evalulated since 'den' is empty","docstring_tokens":["Change","how","the","edit","fields","work",".","Allow","a","\/","in","the","edit","field","to","denote","a","fraction",".","Split","on","\/","and","evaluate","each","side",".","Note","if","<num",">","\/","then","num","is","evalulated","since","den","is","empty"],"function":"def ValidateEntry ( self, entry, minVal, maxVal ):\n\t\t'''\n\t\tChange how the edit fields work. Allow a '\/' in the edit field to\n\t\tdenote a fraction.\n\t\tSplit on '\/' and evaluate each side. Note, if '<num> \/' then\n\t\tnum is evalulated since 'den' is empty\n\t\t'''\n\t\tvals = entry.split('\/',1)\t# entry is text\n\t\tval = vals[0].strip()\n\t\ttry:\t\tnum = float(val)\n\t\texcept:\tnum = None\n\t\telse:\n\t\t\tif len(vals) > 1:\n\t\t\t\tval = vals[1].strip()\n\t\t\t\tif val:\n\t\t\t\t\ttry:\t\t\tden = float(val)\n\t\t\t\t\texcept:\t\tnum = None\n\t\t\t\t\telse:\n\t\t\t\t\t\tif den > 0:\tnum = num \/ den\n\t\t\t\t\t\telse:\t\t\tnum = None\n\t\tif num is not None:\n\t\t\tnum = num if num >= minVal and num <= maxVal else None\n\t\tself.FrameRate.config(style='RedMessage.TLabel' if num is None \\\n\t\t\t\t\t\t\t\t\t else 'DataLabel.TLabel')\n\t\treturn num","function_tokens":["def","ValidateEntry","(","self",",","entry",",","minVal",",","maxVal",")",":","vals","=","entry",".","split","(","'\/'",",","1",")","# entry is text","val","=","vals","[","0","]",".","strip","(",")","try",":","num","=","float","(","val",")","except",":","num","=","None","else",":","if","len","(","vals",")",">","1",":","val","=","vals","[","1","]",".","strip","(",")","if","val",":","try",":","den","=","float","(","val",")","except",":","num","=","None","else",":","if","den",">","0",":","num","=","num","\/","den","else",":","num","=","None","if","num","is","not","None",":","num","=","num","if","num",">=","minVal","and","num","<=","maxVal","else","None","self",".","FrameRate",".","config","(","style","=","'RedMessage.TLabel'","if","num","is","None","else","'DataLabel.TLabel'",")","return","num"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Exposure.py#L473-L497"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Tooltip.py","language":"python","identifier":"ToolTip.__init__","parameters":"( self, wdgt, msg=None, msgFunc=None, follow=1 )","argument_list":"","return_statement":"","docstring":"Initialize the ToolTip\n\t\tArguments:\n\t\t\twdgt: The widget to which this ToolTip is assigned\n\t\t\tmsg: A static string message assigned to the ToolTip\n\t\t\t\t\tif msg istype integer - search for text in TipLines\n\t\t\tmsgFunc: A function that retrieves a string to use as the ToolTip text\n\t\t\tdelay: The delay in seconds before the ToolTip appears(may be float)\n\t\t\tfollow: If True, the ToolTip follows motion, otherwise hides","docstring_summary":"Initialize the ToolTip\n\t\tArguments:\n\t\t\twdgt: The widget to which this ToolTip is assigned\n\t\t\tmsg: A static string message assigned to the ToolTip\n\t\t\t\t\tif msg istype integer - search for text in TipLines\n\t\t\tmsgFunc: A function that retrieves a string to use as the ToolTip text\n\t\t\tdelay: The delay in seconds before the ToolTip appears(may be float)\n\t\t\tfollow: If True, the ToolTip follows motion, otherwise hides","docstring_tokens":["Initialize","the","ToolTip","Arguments",":","wdgt",":","The","widget","to","which","this","ToolTip","is","assigned","msg",":","A","static","string","message","assigned","to","the","ToolTip","if","msg","istype","integer","-","search","for","text","in","TipLines","msgFunc",":","A","function","that","retrieves","a","string","to","use","as","the","ToolTip","text","delay",":","The","delay","in","seconds","before","the","ToolTip","appears","(","may","be","float",")","follow",":","If","True","the","ToolTip","follows","motion","otherwise","hides"],"function":"def __init__( self, wdgt, msg=None, msgFunc=None, follow=1 ):\n\t\t\"\"\"\n\t\tInitialize the ToolTip\n\t\tArguments:\n\t\t\twdgt: The widget to which this ToolTip is assigned\n\t\t\tmsg: A static string message assigned to the ToolTip\n\t\t\t\t\tif msg istype integer - search for text in TipLines\n\t\t\tmsgFunc: A function that retrieves a string to use as the ToolTip text\n\t\t\tdelay: The delay in seconds before the ToolTip appears(may be float)\n\t\t\tfollow: If True, the ToolTip follows motion, otherwise hides\n\t\t\"\"\"\n\t\tself.wdgt = wdgt\n\t\t# The parent of the ToolTip is the parent of the ToolTips widget\n\t\tself.parent = self.wdgt.master\n\t\t# Initalise the Toplevel\n\t\tToplevel.__init__( self, self.parent, bg='black', padx=1, pady=1 )\n\t\tself.withdraw() # Hide initially\n\t\t# The ToolTip Toplevel should have no frame or title bar\n\t\tself.overrideredirect( True )\n\t\t# The msgVar will contain the text displayed by the ToolTip\n\t\tself.msgVar = StringVar()\n\t\tself.TipID = None\n\t\tself.TipNumText = \"\"\n\t\ttry:\n\t\t\tif msg is None:\n\t\t\t\tself.msgVar.set('No tooltip provided')\n\t\t\telif type(msg) is int:\t# lookup tooltip text in file\n\t\t\t\tself.TipID = msg\n\t\t\t\tself.msgVar.set(ToolTip.GetTooltipText(msg))\n\t\t\t\tself.TipNumText = \"Tip number %d\\n\\n\" % self.TipID\n\t\t\telse:\t# assume a string is passed\n\t\t\t\tself.msgVar.set( msg )\n\t\texcept:\n\t\t\tself.msgVar.set('ERROR getting tooltip')\n\t\tself.msgFunc = msgFunc\t\t# call this function to return tip text\n\t\tself.follow = follow\t\t\t# move tip if mouse moves\n\t\tself.visible = 0\n\t\tself.lastMotion = 0\n\t\t# The test of the ToolTip is displayed in a Message widget\n\t\tMessage( self, textvariable=self.msgVar, bg='#FFFFDD',\n\t\t\t\t\taspect=250 ).grid()\n\t\t# Add bindings to the widget. This will NOT override bindings\n\t\t# that the widget already has\n\t\tself.wdgt.bind( '<Enter>', self.spawn, '+' )\n\t\tself.wdgt.bind( '<Leave>', self.hide, '+' )\n\t\tself.wdgt.bind( '<Motion>', self.move, '+' )","function_tokens":["def","__init__","(","self",",","wdgt",",","msg","=","None",",","msgFunc","=","None",",","follow","=","1",")",":","self",".","wdgt","=","wdgt","# The parent of the ToolTip is the parent of the ToolTips widget","self",".","parent","=","self",".","wdgt",".","master","# Initalise the Toplevel","Toplevel",".","__init__","(","self",",","self",".","parent",",","bg","=","'black'",",","padx","=","1",",","pady","=","1",")","self",".","withdraw","(",")","# Hide initially","# The ToolTip Toplevel should have no frame or title bar","self",".","overrideredirect","(","True",")","# The msgVar will contain the text displayed by the ToolTip","self",".","msgVar","=","StringVar","(",")","self",".","TipID","=","None","self",".","TipNumText","=","\"\"","try",":","if","msg","is","None",":","self",".","msgVar",".","set","(","'No tooltip provided'",")","elif","type","(","msg",")","is","int",":","# lookup tooltip text in file","self",".","TipID","=","msg","self",".","msgVar",".","set","(","ToolTip",".","GetTooltipText","(","msg",")",")","self",".","TipNumText","=","\"Tip number %d\\n\\n\"","%","self",".","TipID","else",":","# assume a string is passed","self",".","msgVar",".","set","(","msg",")","except",":","self",".","msgVar",".","set","(","'ERROR getting tooltip'",")","self",".","msgFunc","=","msgFunc","# call this function to return tip text","self",".","follow","=","follow","# move tip if mouse moves","self",".","visible","=","0","self",".","lastMotion","=","0","# The test of the ToolTip is displayed in a Message widget","Message","(","self",",","textvariable","=","self",".","msgVar",",","bg","=","'#FFFFDD'",",","aspect","=","250",")",".","grid","(",")","# Add bindings to the widget. This will NOT override bindings","# that the widget already has","self",".","wdgt",".","bind","(","'<Enter>'",",","self",".","spawn",",","'+'",")","self",".","wdgt",".","bind","(","'<Leave>'",",","self",".","hide",",","'+'",")","self",".","wdgt",".","bind","(","'<Motion>'",",","self",".","move",",","'+'",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Tooltip.py#L102-L147"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Tooltip.py","language":"python","identifier":"ToolTip.spawn","parameters":"( self, event=None )","argument_list":"","return_statement":"","docstring":"Spawn the ToolTip. This simply makes the ToolTip eligible for display.\n\t\tUsually this is caused by entering the widget\n\t\tArguments:\n\t\t\tevent: The event that called this funciton","docstring_summary":"Spawn the ToolTip. This simply makes the ToolTip eligible for display.\n\t\tUsually this is caused by entering the widget\n\t\tArguments:\n\t\t\tevent: The event that called this funciton","docstring_tokens":["Spawn","the","ToolTip",".","This","simply","makes","the","ToolTip","eligible","for","display",".","Usually","this","is","caused","by","entering","the","widget","Arguments",":","event",":","The","event","that","called","this","funciton"],"function":"def spawn( self, event=None ):\n\t\t\"\"\"\n\t\tSpawn the ToolTip. This simply makes the ToolTip eligible for display.\n\t\tUsually this is caused by entering the widget\n\t\tArguments:\n\t\t\tevent: The event that called this funciton\n\t\t\"\"\"\n\t\tself.visible = 1\n\t\t# The after function takes a time argument in miliseconds\n\t\tself.after( int( ToolTip.ShowTipDelay * 1000 ), self.show )","function_tokens":["def","spawn","(","self",",","event","=","None",")",":","self",".","visible","=","1","# The after function takes a time argument in miliseconds","self",".","after","(","int","(","ToolTip",".","ShowTipDelay","*","1000",")",",","self",".","show",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Tooltip.py#L149-L158"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Tooltip.py","language":"python","identifier":"ToolTip.show","parameters":"( self )","argument_list":"","return_statement":"","docstring":"Displays the ToolTip if the time delay has been long enough","docstring_summary":"Displays the ToolTip if the time delay has been long enough","docstring_tokens":["Displays","the","ToolTip","if","the","time","delay","has","been","long","enough"],"function":"def show( self ):\n\t\t\"\"\"\n\t\tDisplays the ToolTip if the time delay has been long enough\n\t\t\"\"\"\n\t\tif ToolTip.ShowToolTips is False: return\n\t\ttext = self.msgVar.get()\n\t\tif ToolTip.ShowTipNumber is True and self.TipID is not None:\n\t\t\t# check if text is not there, if so add it\n\t\t\tif self.TipNumText not in text:\n\t\t\t\tself.msgVar.set(self.TipNumText+text)\n\t\telse:\n\t\t\ttext.replace(self.TipNumText,\"\")\n\t\t\tself.msgVar.set(text)\n\n\t\tif self.visible == 1 and time() - self.lastMotion > ToolTip.ShowTipDelay:\n\t\t\tself.visible = 2\n\t\tif self.visible == 2:\n\t\t\tself.deiconify()","function_tokens":["def","show","(","self",")",":","if","ToolTip",".","ShowToolTips","is","False",":","return","text","=","self",".","msgVar",".","get","(",")","if","ToolTip",".","ShowTipNumber","is","True","and","self",".","TipID","is","not","None",":","# check if text is not there, if so add it","if","self",".","TipNumText","not","in","text",":","self",".","msgVar",".","set","(","self",".","TipNumText","+","text",")","else",":","text",".","replace","(","self",".","TipNumText",",","\"\"",")","self",".","msgVar",".","set","(","text",")","if","self",".","visible","==","1","and","time","(",")","-","self",".","lastMotion",">","ToolTip",".","ShowTipDelay",":","self",".","visible","=","2","if","self",".","visible","==","2",":","self",".","deiconify","(",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Tooltip.py#L160-L177"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Tooltip.py","language":"python","identifier":"ToolTip.move","parameters":"( self, event )","argument_list":"","return_statement":"","docstring":"Processes motion within the widget.\n\t\tArguments:\n\t\tevent: The event that called this function","docstring_summary":"Processes motion within the widget.\n\t\tArguments:\n\t\tevent: The event that called this function","docstring_tokens":["Processes","motion","within","the","widget",".","Arguments",":","event",":","The","event","that","called","this","function"],"function":"def move( self, event ):\n\t\t\"\"\"\n\t\tProcesses motion within the widget.\n\t\tArguments:\n\t\tevent: The event that called this function\n\t\t\"\"\"\n\t\tself.lastMotion = time()\n\t\t# If the follow flag is not set, motion within the widget will\n\t\t# make the ToolTip dissapear\n\t\tif self.follow == False:\n\t\t\tself.withdraw()\n\t\t\tself.visible = 1\n\t\t# Offset the ToolTip 10x10 pixels southeast of the pointer\n\t\tself.geometry( '+%i+%i' % ( event.x_root+10, event.y_root+10 ) )\n\t\t# Try to call the message function. Will not change the message\n\t\t# if the message function is None or the message function fails\n\t\ttry:\t\tself.msgVar.set( self.msgFunc() )\n\t\texcept:\tpass\n\t\tself.after( int( ToolTip.ShowTipDelay * 1000 ), self.show )","function_tokens":["def","move","(","self",",","event",")",":","self",".","lastMotion","=","time","(",")","# If the follow flag is not set, motion within the widget will","# make the ToolTip dissapear","if","self",".","follow","==","False",":","self",".","withdraw","(",")","self",".","visible","=","1","# Offset the ToolTip 10x10 pixels southeast of the pointer","self",".","geometry","(","'+%i+%i'","%","(","event",".","x_root","+","10",",","event",".","y_root","+","10",")",")","# Try to call the message function. Will not change the message","# if the message function is None or the message function fails","try",":","self",".","msgVar",".","set","(","self",".","msgFunc","(",")",")","except",":","pass","self",".","after","(","int","(","ToolTip",".","ShowTipDelay","*","1000",")",",","self",".","show",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Tooltip.py#L179-L197"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Tooltip.py","language":"python","identifier":"ToolTip.hide","parameters":"( self, event=None )","argument_list":"","return_statement":"","docstring":"Hides the ToolTip. Usually this is caused by leaving the widget\n\t\tArguments:\n\t\t\tevent: The event that called this function","docstring_summary":"Hides the ToolTip. Usually this is caused by leaving the widget\n\t\tArguments:\n\t\t\tevent: The event that called this function","docstring_tokens":["Hides","the","ToolTip",".","Usually","this","is","caused","by","leaving","the","widget","Arguments",":","event",":","The","event","that","called","this","function"],"function":"def hide( self, event=None ):\n\t\t\"\"\"\n\t\tHides the ToolTip. Usually this is caused by leaving the widget\n\t\tArguments:\n\t\t\tevent: The event that called this function\n\t\t\"\"\"\n\t\tself.visible = 0\n\t\tself.withdraw()","function_tokens":["def","hide","(","self",",","event","=","None",")",":","self",".","visible","=","0","self",".","withdraw","(",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Tooltip.py#L199-L206"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/Mapping.py","language":"python","identifier":"ControlMapping.SetControlMapping","parameters":"( self )","argument_list":"","return_statement":"","docstring":"Can't seem to get a foucs highlight around some of the controls.\n\t\tSo I'm using color changes to show focus\/tab stops.\n\t\tAlso, the Scale does not seem to get focus by clicking on it\n\t\tNeed to force focus when the user clicks on it","docstring_summary":"Can't seem to get a foucs highlight around some of the controls.\n\t\tSo I'm using color changes to show focus\/tab stops.\n\t\tAlso, the Scale does not seem to get focus by clicking on it\n\t\tNeed to force focus when the user clicks on it","docstring_tokens":["Can","t","seem","to","get","a","foucs","highlight","around","some","of","the","controls",".","So","I","m","using","color","changes","to","show","focus","\/","tab","stops",".","Also","the","Scale","does","not","seem","to","get","focus","by","clicking","on","it","Need","to","force","focus","when","the","user","clicks","on","it"],"function":"def SetControlMapping ( self ):\n\t\t#Style().configure('.', font=('Helvetica', 12)) # all\n\t\tStyle().configure('RedMessage.TLabel',font=('Arial',10,\"italic\"),foreground='red')\n\t\t# These dont work since they're overriden by the map later on... ???\n\t\tStyle().configure('Error.TEntry',background='red',foreground='white')\n\t\tStyle().configure('OK.TEntry',background='white',foreground='black')\n\t\tStyle().configure('DataLabel.TLabel',foreground='blue',font=('Arial',10))\n\t\tStyle().configure('StatusBar.TLabel',background=self.FocusColor,relief=SUNKEN)\n\t\tStyle().configure('TMenu',background='white',activeforeground='lightblue')\n\t\t'''\n\t\tCan't seem to get a foucs highlight around some of the controls.\n\t\tSo I'm using color changes to show focus\/tab stops.\n\t\tAlso, the Scale does not seem to get focus by clicking on it\n\t\tNeed to force focus when the user clicks on it\n\t\t'''\n\t\tStyle().map('TPanedwindow',\n\t\t\tbackground = [\n\t\t\t\t\t\t\t\t('!active','#f0f0ff'),\n\t\t\t\t\t\t\t ],\n\t\t\t)\n\t\tStyle().map('TCombobox',\n\t\t\tfieldbackground = [\n\t\t\t\t\t\t\t ('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t\t ('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t ('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t\t #('disabled','lightgray'), # Use foreground\n\t\t\t\t\t\t\t ],\n\t\t\tforeground = [\n\t\t\t\t\t\t ('disabled','gray'),\n\t\t\t\t\t\t ('!disabled', 'black')\n\t\t\t\t\t\t ],\n\t\t\tselectbackground = [\n\t\t\t\t\t\t\t ('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t\t ('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t ('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t\t #('disabled','lightgray'),\n\t\t\t\t\t\t\t ],\n\t\t\tselectforeground = [\n\t\t\t\t\t\t\t ('!focus','black'),\n\t\t\t\t\t\t\t ('readonly','black'),\n\t\t\t\t\t\t\t ('focus','black'),\n\t\t\t\t\t\t\t ('disabled','black'),\n\t\t\t\t\t\t\t ('!disabled', 'black')\n\t\t\t\t\t\t\t ],\n\t\t\t\t )\t# close map\n\n\t\tStyle().map('TEntry',# This one is just for 'look and feel'\n\t\t\tfieldbackground = [\n\t\t\t\t\t\t\t ('focus','!disabled', '!invalid' ,self.FocusColor),\n\t\t\t\t\t\t\t ('!focus','active','!disabled','!invalid', self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t ('!focus','!active','!disabled','!invalid',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t\t ('invalid', '#FF0000')\n\t\t\t\t\t\t\t #('disabled','lightgray'),\n\t\t\t\t\t\t\t ],\n\t\t\tforeground = [\n\t\t\t\t\t\t ('disabled', '!invalid', 'gray'),\n\t\t\t\t\t\t ('!disabled', '!invalid', 'black')\n\t\t\t\t\t\t #('invalid', self.NoFocusNoMouseOverColor)\n\t\t\t\t\t\t ],\n\t\t\t#background = [\n\t\t\t\t\t\t #('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t #('!focus','active','!disabled',self.NoFocusMouseOverColor'),\n\t\t\t\t\t\t #('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t ##('disabled','lightgray'),\n\t\t\t\t\t\t #],\n\t\t\t#selectbackground = [\n\t\t\t\t\t\t\t #('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t\t #('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t #('!focus','!active','!disabled',self.NoFocusNoMouseOverColor).\n\t\t\t\t\t\t\t ##('disabled','lightgray'),\n\t\t\t\t\t\t\t #],\n\t\t\tselectforeground = [\n\t\t\t\t\t\t\t ('!focus','black'),\n\t\t\t\t\t\t\t ('focus','white'),\n\t\t\t\t\t\t\t ],\n\t\t\t\t ) # close map\n\n\t\t#Style().map('TMenubutton',# This one is just for 'look and feel'\n\t\t\t#fieldbackground = [\n\t\t\t\t\t\t\t #('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t\t #('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t #('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t\t ##('disabled','lightgray'),\n\t\t\t\t\t\t\t #],\n\t\t\t#foreground = [\n\t\t\t\t\t\t #('disabled','gray'),\n\t\t\t\t\t\t #('!disabled', 'black')\n\t\t\t\t\t\t #],\n\t\t\t#background = [\n\t\t\t\t\t\t #('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t #('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t #('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t ##('disabled','lightgray'),\n\t\t\t\t\t\t #],\n\t\t\t#selectbackground = [\n\t\t\t\t\t\t\t #('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t\t #('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t\t #('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t\t ##('disabled','lightgray'),\n\t\t\t\t\t\t\t #],\n\t\t\t#selectforeground = [\n\t\t\t\t\t\t\t #('!focus','black'),\n\t\t\t\t\t\t\t #('focus','white'),\n\t\t\t\t\t\t\t #],\n\t\t\t\t #) # close map\n\n\t\tStyle().map(\"Horizontal.TScale\",\n\t\t\ttroughcolor = [\n\t\t\t\t\t\t ('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t ('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t ('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t ('disabled','lightgray'),\n\t\t\t\t\t\t ],\n\t\t\t\t ) # close map\n\n\t\tStyle().map(\"Vertical.TScale\",\n\t\t\ttroughcolor = [\n\t\t\t\t\t\t ('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t ('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t ('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t ('disabled','lightgray'),\n\t\t\t\t\t\t ],\n\t\t\t\t ) # close map\n\n\t\tStyle().map(\"TMenu\",\n\t\t\tbackground = [\n\t\t\t\t\t\t ('focus','!disabled',self.FocusColor),\n\t\t\t\t\t\t ('!focus','active','!disabled',self.NoFocusMouseOverColor),\n\t\t\t\t\t\t ('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),\n\t\t\t\t\t\t ('disabled','lightgray'),\n\t\t\t\t\t\t ],\n\t\t\t\t )","function_tokens":["def","SetControlMapping","(","self",")",":","#Style().configure('.', font=('Helvetica', 12)) # all","Style","(",")",".","configure","(","'RedMessage.TLabel'",",","font","=","(","'Arial'",",","10",",","\"italic\"",")",",","foreground","=","'red'",")","# These dont work since they're overriden by the map later on... ???","Style","(",")",".","configure","(","'Error.TEntry'",",","background","=","'red'",",","foreground","=","'white'",")","Style","(",")",".","configure","(","'OK.TEntry'",",","background","=","'white'",",","foreground","=","'black'",")","Style","(",")",".","configure","(","'DataLabel.TLabel'",",","foreground","=","'blue'",",","font","=","(","'Arial'",",","10",")",")","Style","(",")",".","configure","(","'StatusBar.TLabel'",",","background","=","self",".","FocusColor",",","relief","=","SUNKEN",")","Style","(",")",".","configure","(","'TMenu'",",","background","=","'white'",",","activeforeground","=","'lightblue'",")","Style","(",")",".","map","(","'TPanedwindow'",",","background","=","[","(","'!active'",",","'#f0f0ff'",")",",","]",",",")","Style","(",")",".","map","(","'TCombobox'",",","fieldbackground","=","[","(","'focus'",",","'!disabled'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","self",".","NoFocusNoMouseOverColor",")",",","#('disabled','lightgray'), # Use foreground","]",",","foreground","=","[","(","'disabled'",",","'gray'",")",",","(","'!disabled'",",","'black'",")","]",",","selectbackground","=","[","(","'focus'",",","'!disabled'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","self",".","NoFocusNoMouseOverColor",")",",","#('disabled','lightgray'),","]",",","selectforeground","=","[","(","'!focus'",",","'black'",")",",","(","'readonly'",",","'black'",")",",","(","'focus'",",","'black'",")",",","(","'disabled'",",","'black'",")",",","(","'!disabled'",",","'black'",")","]",",",")","# close map","Style","(",")",".","map","(","'TEntry'",",","# This one is just for 'look and feel'","fieldbackground","=","[","(","'focus'",",","'!disabled'",",","'!invalid'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","'!invalid'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","'!invalid'",",","self",".","NoFocusNoMouseOverColor",")",",","(","'invalid'",",","'#FF0000'",")","#('disabled','lightgray'),","]",",","foreground","=","[","(","'disabled'",",","'!invalid'",",","'gray'",")",",","(","'!disabled'",",","'!invalid'",",","'black'",")","#('invalid', self.NoFocusNoMouseOverColor)","]",",","#background = [","#('focus','!disabled',self.FocusColor),","#('!focus','active','!disabled',self.NoFocusMouseOverColor'),","#('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),","##('disabled','lightgray'),","#],","#selectbackground = [","#('focus','!disabled',self.FocusColor),","#('!focus','active','!disabled',self.NoFocusMouseOverColor),","#('!focus','!active','!disabled',self.NoFocusNoMouseOverColor).","##('disabled','lightgray'),","#],","selectforeground","=","[","(","'!focus'",",","'black'",")",",","(","'focus'",",","'white'",")",",","]",",",")","# close map","#Style().map('TMenubutton',# This one is just for 'look and feel'","#fieldbackground = [","#('focus','!disabled',self.FocusColor),","#('!focus','active','!disabled',self.NoFocusMouseOverColor),","#('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),","##('disabled','lightgray'),","#],","#foreground = [","#('disabled','gray'),","#('!disabled', 'black')","#],","#background = [","#('focus','!disabled',self.FocusColor),","#('!focus','active','!disabled',self.NoFocusMouseOverColor),","#('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),","##('disabled','lightgray'),","#],","#selectbackground = [","#('focus','!disabled',self.FocusColor),","#('!focus','active','!disabled',self.NoFocusMouseOverColor),","#('!focus','!active','!disabled',self.NoFocusNoMouseOverColor),","##('disabled','lightgray'),","#],","#selectforeground = [","#('!focus','black'),","#('focus','white'),","#],","#) # close map","Style","(",")",".","map","(","\"Horizontal.TScale\"",",","troughcolor","=","[","(","'focus'",",","'!disabled'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","self",".","NoFocusNoMouseOverColor",")",",","(","'disabled'",",","'lightgray'",")",",","]",",",")","# close map","Style","(",")",".","map","(","\"Vertical.TScale\"",",","troughcolor","=","[","(","'focus'",",","'!disabled'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","self",".","NoFocusNoMouseOverColor",")",",","(","'disabled'",",","'lightgray'",")",",","]",",",")","# close map","Style","(",")",".","map","(","\"TMenu\"",",","background","=","[","(","'focus'",",","'!disabled'",",","self",".","FocusColor",")",",","(","'!focus'",",","'active'",",","'!disabled'",",","self",".","NoFocusMouseOverColor",")",",","(","'!focus'",",","'!active'",",","'!disabled'",",","self",".","NoFocusNoMouseOverColor",")",",","(","'disabled'",",","'lightgray'",")",",","]",",",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/Mapping.py#L52-L183"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/PiCameraApp.py","language":"python","identifier":"PiCameraApp.LoadImageFromStream","parameters":"( self, zoom )","argument_list":"","return_statement":"","docstring":"Implement Record Sequence","docstring_summary":"Implement Record Sequence","docstring_tokens":["Implement","Record","Sequence"],"function":"def LoadImageFromStream ( self, zoom ):\n\t\tif self.photo: del self.photo\n\n\t\tself.pictureStream.seek(0)\n\t\tself.CurrentImage = PIL.Image.open(self.pictureStream)\n\t\t# https:\/\/pillow.readthedocs.io\/en\/3.1.x\/reference\/Image.html#the-image-class\n\t\tself.RawEXIFData = None\n\t\tif PreferencesDialog.DefaultPhotoFormat == 'jpeg':\n\t\t\tself.RawEXIFData = self.CurrentImage.info['exif']\t# Works!!!!\n\t\t\t#print ( self.RawEXIFData )\n\t\tself.CameraUtils.AddEXIFTags(self.CurrentImage)\n\t\tself.ShowHideImageAttributesPane(self.viewImageAttributesPane.get())\n\n\t\t# resize what's displayed if user used Ctrl+mousewheel\n\t\tsize = self.CurrentImage.size\n\t\tif size[0] <= 1024 and size[1] <= 768:\t# hold max zoom level\n\t\t\twidth = int(zoom*size[0])\n\t\t\theight = int(zoom*size[1])\n\t\t\tif width <= 1024 and height <= 768:\n\t\t\t\tself.CurrentImage = self.CurrentImage.resize((width,height),PIL.Image.ANTIALIAS)\n\t\tself.CurrentImageSize = self.CurrentImage.size\n\n\t\t# Convert to canvas compatible format and store on canvas\n\t\tself.photo = ImageTk.PhotoImage(self.CurrentImage)\n\t\tself.photoCanvas.delete(\"pic\")\n\t\tself.photoCanvas.create_image(0,0,image=self.photo,anchor='nw',tags=('pic'))\n\t\tself.photoCanvas.config(scrollregion=self.photoCanvas.bbox(ALL))\n\t\tself.photoCanvas.tag_raise(\"objs\") # raise Z order of cursors to topmost\n\t\t'''\n\t\t\tImplement Record Sequence\n\t\t'''","function_tokens":["def","LoadImageFromStream","(","self",",","zoom",")",":","if","self",".","photo",":","del","self",".","photo","self",".","pictureStream",".","seek","(","0",")","self",".","CurrentImage","=","PIL",".","Image",".","open","(","self",".","pictureStream",")","# https:\/\/pillow.readthedocs.io\/en\/3.1.x\/reference\/Image.html#the-image-class","self",".","RawEXIFData","=","None","if","PreferencesDialog",".","DefaultPhotoFormat","==","'jpeg'",":","self",".","RawEXIFData","=","self",".","CurrentImage",".","info","[","'exif'","]","# Works!!!!","#print ( self.RawEXIFData )","self",".","CameraUtils",".","AddEXIFTags","(","self",".","CurrentImage",")","self",".","ShowHideImageAttributesPane","(","self",".","viewImageAttributesPane",".","get","(",")",")","# resize what's displayed if user used Ctrl+mousewheel","size","=","self",".","CurrentImage",".","size","if","size","[","0","]","<=","1024","and","size","[","1","]","<=","768",":","# hold max zoom level","width","=","int","(","zoom","*","size","[","0","]",")","height","=","int","(","zoom","*","size","[","1","]",")","if","width","<=","1024","and","height","<=","768",":","self",".","CurrentImage","=","self",".","CurrentImage",".","resize","(","(","width",",","height",")",",","PIL",".","Image",".","ANTIALIAS",")","self",".","CurrentImageSize","=","self",".","CurrentImage",".","size","# Convert to canvas compatible format and store on canvas","self",".","photo","=","ImageTk",".","PhotoImage","(","self",".","CurrentImage",")","self",".","photoCanvas",".","delete","(","\"pic\"",")","self",".","photoCanvas",".","create_image","(","0",",","0",",","image","=","self",".","photo",",","anchor","=","'nw'",",","tags","=","(","'pic'",")",")","self",".","photoCanvas",".","config","(","scrollregion","=","self",".","photoCanvas",".","bbox","(","ALL",")",")","self",".","photoCanvas",".","tag_raise","(","\"objs\"",")","# raise Z order of cursors to topmost"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/PiCameraApp.py#L755-L785"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/PiCameraApp.py","language":"python","identifier":"PiCameraApp.LoseFocus","parameters":"( self, event )","argument_list":"","return_statement":"","docstring":"The Combobox is a problem.\n\t\tCould save last two entries... if Combobox, Labelframe, Tk...\n\t\tNO! this could be the Topwindow losing focus while the\n\t\tCombobox has the focus. The same effect\n\t\tAlso, the nesting may vary based on where the Combobox is in\n\t\tthe hierarcy. What I really want is to capture the <B1-Motion>\n\t\ton the TopWindow titlebar - OR - get the widget ID to the\n\t\tCombobox Toplevel dropdown window.","docstring_summary":"The Combobox is a problem.\n\t\tCould save last two entries... if Combobox, Labelframe, Tk...\n\t\tNO! this could be the Topwindow losing focus while the\n\t\tCombobox has the focus. The same effect\n\t\tAlso, the nesting may vary based on where the Combobox is in\n\t\tthe hierarcy. What I really want is to capture the <B1-Motion>\n\t\ton the TopWindow titlebar - OR - get the widget ID to the\n\t\tCombobox Toplevel dropdown window.","docstring_tokens":["The","Combobox","is","a","problem",".","Could","save","last","two","entries","...","if","Combobox","Labelframe","Tk","...","NO!","this","could","be","the","Topwindow","losing","focus","while","the","Combobox","has","the","focus",".","The","same","effect","Also","the","nesting","may","vary","based","on","where","the","Combobox","is","in","the","hierarcy",".","What","I","really","want","is","to","capture","the","<B1","-","Motion",">","on","the","TopWindow","titlebar","-","OR","-","get","the","widget","ID","to","the","Combobox","Toplevel","dropdown","window","."],"function":"def LoseFocus ( self, event ):\n\t\t'''\n\t\t\t\t\t\t\tThe Combobox is a problem.\n\t\tCould save last two entries... if Combobox, Labelframe, Tk...\n\t\tNO! this could be the Topwindow losing focus while the\n\t\tCombobox has the focus. The same effect\n\t\tAlso, the nesting may vary based on where the Combobox is in\n\t\tthe hierarcy. What I really want is to capture the <B1-Motion>\n\t\ton the TopWindow titlebar - OR - get the widget ID to the\n\t\tCombobox Toplevel dropdown window.\n\t\t'''\n\t\tif self.camera.preview and not self.AlwaysPreview and \\\n\t\t\tevent.widget.winfo_class().lower() == 'tk' and \\\n\t\t\tself.root.attributes(\"-topmost\") == 0: # TopMost window hack\n\t\t\tif self.ShowOnScreen.get() == False:\n\t\t\t\tself.camera.preview.alpha = 0\n\t\t\tself.ImageCanvas.itemconfigure('nopreview',state='normal')","function_tokens":["def","LoseFocus","(","self",",","event",")",":","if","self",".","camera",".","preview","and","not","self",".","AlwaysPreview","and","event",".","widget",".","winfo_class","(",")",".","lower","(",")","==","'tk'","and","self",".","root",".","attributes","(","\"-topmost\"",")","==","0",":","# TopMost window hack","if","self",".","ShowOnScreen",".","get","(",")","==","False",":","self",".","camera",".","preview",".","alpha","=","0","self",".","ImageCanvas",".","itemconfigure","(","'nopreview'",",","state","=","'normal'",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/PiCameraApp.py#L967-L983"}
{"nwo":"Billwilliams1952\/PiCameraApp","sha":"61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0","path":"Source\/PreferencesDialog.py","language":"python","identifier":"General.BuildPage","parameters":"( self )","argument_list":"","return_statement":"","docstring":"Configuration files in python\n\t\tThere are several ways to do this depending on the file format required.\n\t\tConfigParser [.ini format]\n\t\tWrite a file like so:\n\t\t\tfrom ConfigParser import SafeConfigParser\n\t\t\tconfig = SafeConfigParser()\n\t\t\tconfig.read('config.ini')\n\t\t\tconfig.add_section('main')\n\t\t\tconfig.set('main', 'key1', 'value1')\n\t\t\tconfig.set('main', 'key2', 'value2')\n\t\t\tconfig.set('main', 'key3', 'value3')","docstring_summary":"Configuration files in python\n\t\tThere are several ways to do this depending on the file format required.\n\t\tConfigParser [.ini format]\n\t\tWrite a file like so:\n\t\t\tfrom ConfigParser import SafeConfigParser\n\t\t\tconfig = SafeConfigParser()\n\t\t\tconfig.read('config.ini')\n\t\t\tconfig.add_section('main')\n\t\t\tconfig.set('main', 'key1', 'value1')\n\t\t\tconfig.set('main', 'key2', 'value2')\n\t\t\tconfig.set('main', 'key3', 'value3')","docstring_tokens":["Configuration","files","in","python","There","are","several","ways","to","do","this","depending","on","the","file","format","required",".","ConfigParser","[",".","ini","format","]","Write","a","file","like","so",":","from","ConfigParser","import","SafeConfigParser","config","=","SafeConfigParser","()","config",".","read","(","config",".","ini",")","config",".","add_section","(","main",")","config",".","set","(","main","key1","value1",")","config",".","set","(","main","key2","value2",")","config",".","set","(","main","key3","value3",")"],"function":"def BuildPage ( self ):\n\t\t# Setup default folder to save pictures and videos\n\t\tf = MyLabelFrame(self,'Set default directories',0,0)\n\n\t\tself.iconCameraBig = PIL.Image.open('Assets\/camera-icon.png')\n\t\tself.iconCameraBig = ImageTk.PhotoImage(self.iconCameraBig.resize((22,22),Image.ANTIALIAS))\n\t\tself.iconVideoBig = PIL.Image.open('Assets\/video-icon-b.png')\n\t\tself.iconVideoBig = ImageTk.PhotoImage(self.iconVideoBig.resize((22,22),Image.ANTIALIAS))\n\t\tself.iconFiles = PIL.Image.open('Assets\/files.png')\n\t\tself.iconFiles = ImageTk.PhotoImage(self.iconFiles.resize((22,22),Image.ANTIALIAS))\n\n\t\tb = ttk.Button(f,text=\"Photos...\",image=self.iconCameraBig,compound='left',\n\t\t\tcommand=self.SelectPhotoDirectory,width=7)\n\t\tb.grid(row=0,column=0,sticky='W',pady=(5,5))\n\t\tToolTip(b,6000)\n\t\tself.PhotoDirLabel = Label(f,foreground='#0000FF',\n\t\t\ttext=PreferencesDialog.DefaultPhotoDir,anchor=W)\n\t\tself.PhotoDirLabel.grid(row=0,column=1,sticky='EW',padx=10);\n\t\tToolTip(self.PhotoDirLabel,6001)\n\n\t\tb = ttk.Button(f,text=\"Videos...\",image=self.iconVideoBig,compound='left',\n\t\t\tcommand=self.SelectVideoDirectory,width=7)\n\t\tb.grid(row=1,column=0,sticky='W')\n\t\tToolTip(b,6002)\n\t\tself.VideoDirLabel = Label(f,foreground='#0000FF',\n\t\t\ttext=PreferencesDialog.DefaultVideoDir,anchor=W)\n\t\tself.VideoDirLabel.grid(row=1,column=1,sticky='EW',padx=10);\n\t\tToolTip(self.VideoDirLabel,6003)\n\n\t\tb = ttk.Button(f,text=\"Files...\",image=self.iconFiles,compound='left',\n\t\t\tcommand=self.SelectFilesDirectory,width=7)\n\t\tb.grid(row=2,column=0,sticky='W',pady=(5,5))\n\t\tToolTip(b,6004)\n\t\tself.FilesDirLabel = Label(f,foreground='#0000FF',\n\t\t\ttext=PreferencesDialog.DefaultFilesDir,anchor=W)\n\t\tself.FilesDirLabel.grid(row=2,column=1,sticky='EW',padx=10);\n\t\tToolTip(self.FilesDirLabel,6005)\n\n\t\tf = MyLabelFrame(self,'Photo\/Video capture formats',1,0)\n\n\t\tttk.Label(f,text='Photo capture format',padding=(5,5,5,5)) \\\n\t\t\t.grid(row=0,column=0,sticky='W')\n\t\tself.photoCaptureFormatCombo = Combobox(f,height=15,width=8,\n\t\t\tstate='readonly')#,width=15)\n\t\tself.photoCaptureFormatCombo.grid(row=0,column=1,sticky='EW')\n\t\tself.photoFormats = ['jpeg','png','bmp',\n\t\t\t'gif','yuv','rgb','rgba','bgr','bgra','raw']\n\t\tself.photoCaptureFormatCombo['values'] = self.photoFormats\n\t\tself.photoCaptureFormatCombo.current( \\\n\t\t\tself.photoFormats.index(PreferencesDialog.DefaultPhotoFormat))\n\t\tself.photoCaptureFormatCombo.bind('<<ComboboxSelected>>',\n\t\t\tself.photoCaptureFormatChanged)\n\t\tToolTip(self.photoCaptureFormatCombo, msg=6010)\n\t\tself.ModFormatParams = ttk.Button(f,text='Params...',\n\t\t\tcommand=self.ModifyFormatParamPressed,\n\t\t\tunderline=0,padding=(5,3,5,3),width=8)\n\t\tself.ModFormatParams.grid(row=0,column=2,sticky='W',padx=5)\n\t\tToolTip(self.ModFormatParams, msg=6011)\n\n\t\tttk.Label(f,text='Video capture format',padding=(5,5,5,5)) \\\n\t\t\t.grid(row=1,column=0,sticky='W')\n\t\tself.VideoCaptureFormatCombo = Combobox(f,height=15,width=8,\n\t\t\tstate='readonly')#,width=15)\n\t\tself.VideoCaptureFormatCombo.grid(row=1,column=1,sticky='EW')\n\t\tself.videoFormats = ['h264','mjpeg','yuv',\n\t\t\t'rgb','rgba','bgr','bgra']\n\t\tself.VideoCaptureFormatCombo['values'] = self.videoFormats\n\t\tself.VideoCaptureFormatCombo.current( \\\n\t\t\tself.videoFormats.index(PreferencesDialog.DefaultVideoFormat))\n\t\tself.VideoCaptureFormatCombo.bind('<<ComboboxSelected>>',\n\t\t\tself.VideoCaptureFormatChanged)\n\t\tToolTip(self.VideoCaptureFormatCombo,6020)\n\t\tself.ModVideoFormatParams = ttk.Button(f,text='Params...',\n\t\t\tcommand=self.ModifyVideoFormatParamPressed,\n\t\t\tunderline=0,padding=(5,3,5,3),width=8)\n\t\tself.ModVideoFormatParams.grid(row=1,column=2,sticky='W',padx=5)\n\t\tToolTip(self.ModVideoFormatParams,6021)\n\t\t# Save \/ Restore camera settings? This may be a bit to do\n\n\t\tf = MyLabelFrame(self,'Photo\/Video naming',2,0)\n\t\tLabel(f,text='Timestamp format:') \\\n\t\t\t.grid(row=0,column=0,sticky='W')\n\t\tokCmd = (self.register(self.ValidateTimestamp),'%P')\n\t\tself.TimeStamp = MyStringVar(PreferencesDialog.DefaultTimestampFormat)\n\t\te = Entry(f,width=20,validate='all',\n\t\t\ttextvariable=self.TimeStamp)\n\t\te.grid(row=0,column=1,sticky='W')\n\t\tToolTip(e,6050)\n\n\t\timage = PIL.Image.open('Assets\/help.png')\n\t\tself.helpimage = ImageTk.PhotoImage(image.resize((16,16)))\n\t\tb = ttk.Button(f,image=self.helpimage,width=10,\n\t\t\tcommand=self.FormatHelp,padding=(2,2,2,2))\n\t\tb.grid(row=0,column=2,padx=5)\n\t\tToolTip(b,6052)\n\n\t\tLabel(f,text='Sample timestamp:').grid(row=1,column=0,sticky='W')\n\t\tself.TimestampLabel = MyStringVar(datetime.datetime.now() \\\n\t\t\t.strftime(PreferencesDialog.DefaultTimestampFormat))\n\t\tself.tsl = Label(f,textvariable=self.TimestampLabel,foreground='#0000FF')\n\t\tself.tsl.grid(row=1,column=1,columnspan=2,sticky='W')\n\t\tToolTip(self.tsl,6051)\n\t\tself.after(1000,self.UpdateTimestamp)\n\n\t\tself.PhotoTimestampVar = MyBooleanVar(PreferencesDialog.PhotoTimestamp)\n\t\tself.PhotoTimestamp = Checkbutton(f,text='Include timestamp in photo name',\n\t\t\tvariable=self.PhotoTimestampVar, command=self.PhotoTimestampChecked)\n\t\tself.PhotoTimestamp.grid(row=2,column=0,columnspan=2,sticky='W')\n\t\tToolTip(self.PhotoTimestamp,6060)\n\n\t\tself.VideoTimestampVar = MyBooleanVar(PreferencesDialog.VideoTimestamp)\n\t\tself.VideoTimestamp = Checkbutton(f,text='Include timestamp in video name',\n\t\t\tvariable=self.VideoTimestampVar, command=self.VideoTimestampChecked)\n\t\tself.VideoTimestamp.grid(row=3,column=0,columnspan=2,sticky='W')\n\t\tToolTip(self.VideoTimestamp,6061)\n\n\t\te.config(validatecommand=okCmd)\n\t\t'''\n\t\tConfiguration files in python\n\t\tThere are several ways to do this depending on the file format required.\n\t\tConfigParser [.ini format]\n\t\tWrite a file like so:\n\t\t\tfrom ConfigParser import SafeConfigParser\n\t\t\tconfig = SafeConfigParser()\n\t\t\tconfig.read('config.ini')\n\t\t\tconfig.add_section('main')\n\t\t\tconfig.set('main', 'key1', 'value1')\n\t\t\tconfig.set('main', 'key2', 'value2')\n\t\t\tconfig.set('main', 'key3', 'value3')\n\t\t'''\n\t\tself.photoCaptureFormatChanged(None)\n\t\tself.VideoCaptureFormatChanged(None)","function_tokens":["def","BuildPage","(","self",")",":","# Setup default folder to save pictures and videos","f","=","MyLabelFrame","(","self",",","'Set default directories'",",","0",",","0",")","self",".","iconCameraBig","=","PIL",".","Image",".","open","(","'Assets\/camera-icon.png'",")","self",".","iconCameraBig","=","ImageTk",".","PhotoImage","(","self",".","iconCameraBig",".","resize","(","(","22",",","22",")",",","Image",".","ANTIALIAS",")",")","self",".","iconVideoBig","=","PIL",".","Image",".","open","(","'Assets\/video-icon-b.png'",")","self",".","iconVideoBig","=","ImageTk",".","PhotoImage","(","self",".","iconVideoBig",".","resize","(","(","22",",","22",")",",","Image",".","ANTIALIAS",")",")","self",".","iconFiles","=","PIL",".","Image",".","open","(","'Assets\/files.png'",")","self",".","iconFiles","=","ImageTk",".","PhotoImage","(","self",".","iconFiles",".","resize","(","(","22",",","22",")",",","Image",".","ANTIALIAS",")",")","b","=","ttk",".","Button","(","f",",","text","=","\"Photos...\"",",","image","=","self",".","iconCameraBig",",","compound","=","'left'",",","command","=","self",".","SelectPhotoDirectory",",","width","=","7",")","b",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'W'",",","pady","=","(","5",",","5",")",")","ToolTip","(","b",",","6000",")","self",".","PhotoDirLabel","=","Label","(","f",",","foreground","=","'#0000FF'",",","text","=","PreferencesDialog",".","DefaultPhotoDir",",","anchor","=","W",")","self",".","PhotoDirLabel",".","grid","(","row","=","0",",","column","=","1",",","sticky","=","'EW'",",","padx","=","10",")","ToolTip","(","self",".","PhotoDirLabel",",","6001",")","b","=","ttk",".","Button","(","f",",","text","=","\"Videos...\"",",","image","=","self",".","iconVideoBig",",","compound","=","'left'",",","command","=","self",".","SelectVideoDirectory",",","width","=","7",")","b",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'W'",")","ToolTip","(","b",",","6002",")","self",".","VideoDirLabel","=","Label","(","f",",","foreground","=","'#0000FF'",",","text","=","PreferencesDialog",".","DefaultVideoDir",",","anchor","=","W",")","self",".","VideoDirLabel",".","grid","(","row","=","1",",","column","=","1",",","sticky","=","'EW'",",","padx","=","10",")","ToolTip","(","self",".","VideoDirLabel",",","6003",")","b","=","ttk",".","Button","(","f",",","text","=","\"Files...\"",",","image","=","self",".","iconFiles",",","compound","=","'left'",",","command","=","self",".","SelectFilesDirectory",",","width","=","7",")","b",".","grid","(","row","=","2",",","column","=","0",",","sticky","=","'W'",",","pady","=","(","5",",","5",")",")","ToolTip","(","b",",","6004",")","self",".","FilesDirLabel","=","Label","(","f",",","foreground","=","'#0000FF'",",","text","=","PreferencesDialog",".","DefaultFilesDir",",","anchor","=","W",")","self",".","FilesDirLabel",".","grid","(","row","=","2",",","column","=","1",",","sticky","=","'EW'",",","padx","=","10",")","ToolTip","(","self",".","FilesDirLabel",",","6005",")","f","=","MyLabelFrame","(","self",",","'Photo\/Video capture formats'",",","1",",","0",")","ttk",".","Label","(","f",",","text","=","'Photo capture format'",",","padding","=","(","5",",","5",",","5",",","5",")",")",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'W'",")","self",".","photoCaptureFormatCombo","=","Combobox","(","f",",","height","=","15",",","width","=","8",",","state","=","'readonly'",")","#,width=15)","self",".","photoCaptureFormatCombo",".","grid","(","row","=","0",",","column","=","1",",","sticky","=","'EW'",")","self",".","photoFormats","=","[","'jpeg'",",","'png'",",","'bmp'",",","'gif'",",","'yuv'",",","'rgb'",",","'rgba'",",","'bgr'",",","'bgra'",",","'raw'","]","self",".","photoCaptureFormatCombo","[","'values'","]","=","self",".","photoFormats","self",".","photoCaptureFormatCombo",".","current","(","self",".","photoFormats",".","index","(","PreferencesDialog",".","DefaultPhotoFormat",")",")","self",".","photoCaptureFormatCombo",".","bind","(","'<<ComboboxSelected>>'",",","self",".","photoCaptureFormatChanged",")","ToolTip","(","self",".","photoCaptureFormatCombo",",","msg","=","6010",")","self",".","ModFormatParams","=","ttk",".","Button","(","f",",","text","=","'Params...'",",","command","=","self",".","ModifyFormatParamPressed",",","underline","=","0",",","padding","=","(","5",",","3",",","5",",","3",")",",","width","=","8",")","self",".","ModFormatParams",".","grid","(","row","=","0",",","column","=","2",",","sticky","=","'W'",",","padx","=","5",")","ToolTip","(","self",".","ModFormatParams",",","msg","=","6011",")","ttk",".","Label","(","f",",","text","=","'Video capture format'",",","padding","=","(","5",",","5",",","5",",","5",")",")",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'W'",")","self",".","VideoCaptureFormatCombo","=","Combobox","(","f",",","height","=","15",",","width","=","8",",","state","=","'readonly'",")","#,width=15)","self",".","VideoCaptureFormatCombo",".","grid","(","row","=","1",",","column","=","1",",","sticky","=","'EW'",")","self",".","videoFormats","=","[","'h264'",",","'mjpeg'",",","'yuv'",",","'rgb'",",","'rgba'",",","'bgr'",",","'bgra'","]","self",".","VideoCaptureFormatCombo","[","'values'","]","=","self",".","videoFormats","self",".","VideoCaptureFormatCombo",".","current","(","self",".","videoFormats",".","index","(","PreferencesDialog",".","DefaultVideoFormat",")",")","self",".","VideoCaptureFormatCombo",".","bind","(","'<<ComboboxSelected>>'",",","self",".","VideoCaptureFormatChanged",")","ToolTip","(","self",".","VideoCaptureFormatCombo",",","6020",")","self",".","ModVideoFormatParams","=","ttk",".","Button","(","f",",","text","=","'Params...'",",","command","=","self",".","ModifyVideoFormatParamPressed",",","underline","=","0",",","padding","=","(","5",",","3",",","5",",","3",")",",","width","=","8",")","self",".","ModVideoFormatParams",".","grid","(","row","=","1",",","column","=","2",",","sticky","=","'W'",",","padx","=","5",")","ToolTip","(","self",".","ModVideoFormatParams",",","6021",")","# Save \/ Restore camera settings? This may be a bit to do","f","=","MyLabelFrame","(","self",",","'Photo\/Video naming'",",","2",",","0",")","Label","(","f",",","text","=","'Timestamp format:'",")",".","grid","(","row","=","0",",","column","=","0",",","sticky","=","'W'",")","okCmd","=","(","self",".","register","(","self",".","ValidateTimestamp",")",",","'%P'",")","self",".","TimeStamp","=","MyStringVar","(","PreferencesDialog",".","DefaultTimestampFormat",")","e","=","Entry","(","f",",","width","=","20",",","validate","=","'all'",",","textvariable","=","self",".","TimeStamp",")","e",".","grid","(","row","=","0",",","column","=","1",",","sticky","=","'W'",")","ToolTip","(","e",",","6050",")","image","=","PIL",".","Image",".","open","(","'Assets\/help.png'",")","self",".","helpimage","=","ImageTk",".","PhotoImage","(","image",".","resize","(","(","16",",","16",")",")",")","b","=","ttk",".","Button","(","f",",","image","=","self",".","helpimage",",","width","=","10",",","command","=","self",".","FormatHelp",",","padding","=","(","2",",","2",",","2",",","2",")",")","b",".","grid","(","row","=","0",",","column","=","2",",","padx","=","5",")","ToolTip","(","b",",","6052",")","Label","(","f",",","text","=","'Sample timestamp:'",")",".","grid","(","row","=","1",",","column","=","0",",","sticky","=","'W'",")","self",".","TimestampLabel","=","MyStringVar","(","datetime",".","datetime",".","now","(",")",".","strftime","(","PreferencesDialog",".","DefaultTimestampFormat",")",")","self",".","tsl","=","Label","(","f",",","textvariable","=","self",".","TimestampLabel",",","foreground","=","'#0000FF'",")","self",".","tsl",".","grid","(","row","=","1",",","column","=","1",",","columnspan","=","2",",","sticky","=","'W'",")","ToolTip","(","self",".","tsl",",","6051",")","self",".","after","(","1000",",","self",".","UpdateTimestamp",")","self",".","PhotoTimestampVar","=","MyBooleanVar","(","PreferencesDialog",".","PhotoTimestamp",")","self",".","PhotoTimestamp","=","Checkbutton","(","f",",","text","=","'Include timestamp in photo name'",",","variable","=","self",".","PhotoTimestampVar",",","command","=","self",".","PhotoTimestampChecked",")","self",".","PhotoTimestamp",".","grid","(","row","=","2",",","column","=","0",",","columnspan","=","2",",","sticky","=","'W'",")","ToolTip","(","self",".","PhotoTimestamp",",","6060",")","self",".","VideoTimestampVar","=","MyBooleanVar","(","PreferencesDialog",".","VideoTimestamp",")","self",".","VideoTimestamp","=","Checkbutton","(","f",",","text","=","'Include timestamp in video name'",",","variable","=","self",".","VideoTimestampVar",",","command","=","self",".","VideoTimestampChecked",")","self",".","VideoTimestamp",".","grid","(","row","=","3",",","column","=","0",",","columnspan","=","2",",","sticky","=","'W'",")","ToolTip","(","self",".","VideoTimestamp",",","6061",")","e",".","config","(","validatecommand","=","okCmd",")","self",".","photoCaptureFormatChanged","(","None",")","self",".","VideoCaptureFormatChanged","(","None",")"],"url":"https:\/\/github.com\/Billwilliams1952\/PiCameraApp\/blob\/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0\/Source\/PreferencesDialog.py#L111-L242"}