@@ -1274,27 +1274,27 @@ def musicCallback(answer):
12741274 mediaPlayer .switchToPlayList ()
12751275
12761276 def mviCallback (answer = None ):
1277- def processImage (data , retVal , extraArgs ):
1277+ def processPicture (data , retVal , extraArgs ):
12781278 def cleanUp (index ):
12791279 if not filePreExists :
1280- remove (imagePath )
1280+ remove (picturePath )
12811281
1282- # print(f"[FileCommander] processImage DEBUG: Return value is {retVal}\n{data}.")
1283- answer , path , imagePath , filePreExists = extraArgs
1282+ # print(f"[FileCommander] processPicture DEBUG: Return value is {retVal}\n{data}.")
1283+ answer , path , picturePath , filePreExists = extraArgs
12841284 if retVal == 0 :
12851285 if not filePreExists :
1286- chmod (imagePath , 0o644 )
1286+ chmod (picturePath , 0o644 )
12871287 if "SHOW" in answer :
12881288 if "SAVE" in answer or "TARGET" in answer :
1289- self .session .open (FileCommanderImageViewer , imagePath , 0 , None , basename (imagePath ))
1289+ self .session .open (FileCommanderPictureViewer , picturePath , 0 , None , basename (picturePath ))
12901290 else :
1291- self .session .openWithCallback (cleanUp , FileCommanderImageViewer , imagePath , 0 , None , basename (imagePath ))
1291+ self .session .openWithCallback (cleanUp , FileCommanderPictureViewer , picturePath , 0 , None , basename (picturePath ))
12921292
12931293 if answer :
12941294 path = self .sourceColumn .getPath ()
1295- imagePath = join (self .targetColumn .getCurrentDirectory () if "TARGET" in answer else gettempdir (), f"{ splitext (basename (path ))[0 ]} .jpg" )
1296- filePreExists = exists (imagePath )
1297- console ().ePopen (["/usr/bin/ffmpeg" , "/usr/bin/ffmpeg" , "-y" , "-hide_banner" , "-f" , "mpegvideo" , "-i" , path , "-frames:v" , "1" , "-r" , "1/1" , imagePath ], processImage , (answer , path , imagePath , filePreExists ))
1295+ picturePath = join (self .targetColumn .getCurrentDirectory () if "TARGET" in answer else gettempdir (), f"{ splitext (basename (path ))[0 ]} .jpg" )
1296+ filePreExists = exists (picturePath )
1297+ console ().ePopen (["/usr/bin/ffmpeg" , "/usr/bin/ffmpeg" , "-y" , "-hide_banner" , "-f" , "mpegvideo" , "-i" , path , "-frames:v" , "1" , "-r" , "1/1" , picturePath ], processPicture , (answer , path , picturePath , filePreExists ))
12981298
12991299 def scriptCallback (answer ):
13001300 def successCallback (job ):
@@ -1487,7 +1487,7 @@ def selectionCallback(answer):
14871487 ]
14881488 self .session .openWithCallback (musicCallback , MessageBox , text = f"{ _ ("What would you like to do with the audio file:" )} \n \n { path } " , list = choiceList , windowTitle = self .baseTitle )
14891489 elif fileType in IMAGE_EXTENSIONS :
1490- self .session .openWithCallback (imageCallback , FileCommanderImageViewer , self .sourceColumn .getFileList (), self .sourceColumn .getCurrentIndex (), self .sourceColumn .getCurrentDirectory (), basename (path )) # DEBUG: path is not needed!
1490+ self .session .openWithCallback (imageCallback , FileCommanderPictureViewer , self .sourceColumn .getFileList (), self .sourceColumn .getCurrentIndex (), self .sourceColumn .getCurrentDirectory (), basename (path )) # DEBUG: path is not needed!
14911491 elif fileType in (".sh" , ".py" , ".pyc" ):
14921492 choiceList = [
14931493 (_ ("Cancel" ), "" ),
@@ -1654,7 +1654,7 @@ def sortFilesCallback(answer):
16541654 self .updateHeading (self .sourceColumn )
16551655 self .updateSort ()
16561656
1657- column = "left" if self .leftActive else "right"
1657+ column = _ ( "left column" ) if self .leftActive else _ ( "right column" )
16581658 choiceList = [
16591659 (_ ("Cancel" ), "" ),
16601660 (_ ("Name ascending" ), "0.0" ),
@@ -1664,7 +1664,8 @@ def sortFilesCallback(answer):
16641664 (_ ("Size ascending" ), "2.0" ),
16651665 (_ ("Size descending" ), "2.1" )
16661666 ]
1667- self .session .openWithCallback (sortFilesCallback , MessageBox , text = (_ ("Select the file sort order for the %s column:" ) % column ), list = choiceList , windowTitle = self .baseTitle )
1667+ # TRANSLATORS: "Select the file sort order for the %s:" / the placeholder is "left column" or "right column".
1668+ self .session .openWithCallback (sortFilesCallback , MessageBox , text = (_ ("Select the file sort order for the %s:" ) % column ), list = choiceList , windowTitle = self .baseTitle )
16681669
16691670 def keyTaskList (self ):
16701671 self .taskList = []
@@ -2291,9 +2292,9 @@ def keyText(self):
22912292 self ["textAction" ].setEnabled (False )
22922293
22932294
2294- class FileCommanderImageViewer (Screen ):
2295+ class FileCommanderPictureViewer (Screen ):
22952296 skin = """
2296- <screen name="FileCommanderImageViewer " title="File Commander Image Viewer" position="fill" flags="wfNoBorder" resolution="1280,720">
2297+ <screen name="FileCommanderPictureViewer " title="File Commander Picture Viewer" position="fill" flags="wfNoBorder" resolution="1280,720">
22972298 <eLabel position="fill" backgroundColor="#00000000" />
22982299 <widget name="image" position="0,0" size="1280,720" alphatest="on" zPosition="+1" />
22992300 <widget source="message" render="Label" position="10,685" size="1210,25" borderColor="#00000000" borderWidth="2" font="Regular;20" foregroundColor="#0038FF48" noWrap="1" transparent="1" valign="bottom" zPosition="+2" />
@@ -2330,38 +2331,38 @@ class FileCommanderImageViewer(Screen):
23302331
23312332 def __init__ (self , session , fileList , index , path , filename ): # DEBUG: path is not needed!
23322333 Screen .__init__ (self , session , mandatoryWidgets = ["infolabels" ], enableHelp = True )
2333- self .skinName = ["FileCommanderImageViewer" ]
2334+ self .skinName = ["FileCommanderImageViewer" , "FileCommanderPictureViewer" ]
23342335 if not self .getTitle ():
2335- self .setTitle (_ ("File Commander Image Viewer" ))
2336+ self .setTitle (_ ("File Commander Picture Viewer" ))
23362337 self .startIndex = index
23372338 self .lastIndex = index
23382339 self ["actions" ] = HelpableActionMap (self , ["OkCancelActions" , "InfoActions" , "ColorActions" , "NavigationActions" ], {
2339- "cancel" : (self .keyCancel , _ ("Exit image viewer" )),
2340- "ok" : (self .keyToggleOverlay , _ ("Toggle display of the image status overlay" )),
2341- "info" : (self .keyToggleInformation , _ ("Toggle display of image information" )),
2342- "red" : (self .keyCancel , _ ("Exit image viewer" )),
2343- "green" : (self .keyToggleInformation , _ ("Toggle display of image information" )),
2340+ "cancel" : (self .keyCancel , _ ("Exit picture viewer" )),
2341+ "ok" : (self .keyToggleOverlay , _ ("Toggle display of the picture status overlay" )),
2342+ "info" : (self .keyToggleInformation , _ ("Toggle display of picture information" )),
2343+ "red" : (self .keyCancel , _ ("Exit picture viewer" )),
2344+ "green" : (self .keyToggleInformation , _ ("Toggle display of picture information" )),
23442345 "yellow" : (self .keySlideshow , _ ("Start/stop slide show" )),
2345- "up" : (self .keyFirstImage , _ ("Show first image " )),
2346- "first" : (self .keyFirstImage , _ ("Show first image " )),
2347- "left" : (self .keyPreviousImage , _ ("Show previous image " )),
2348- "right" : (self .keyNextImage , _ ("Show next image " )),
2349- "last" : (self .keyLastImage , _ ("Show last image " )),
2350- "down" : (self .keyLastImage , _ ("Show last image " ))
2351- }, prio = 0 , description = _ ("File Commander Image Viewer Actions" ))
2346+ "up" : (self .keyFirstPicture , _ ("Show first picture " )),
2347+ "first" : (self .keyFirstPicture , _ ("Show first picture " )),
2348+ "left" : (self .keyPreviousPicture , _ ("Show previous picture " )),
2349+ "right" : (self .keyNextPicture , _ ("Show next picture " )),
2350+ "last" : (self .keyLastPicture , _ ("Show last picture " )),
2351+ "down" : (self .keyLastPicture , _ ("Show last picture " ))
2352+ }, prio = 0 , description = _ ("File Commander Picture Viewer Actions" ))
23522353 self ["image" ] = Pixmap ()
23532354 self ["icon" ] = Pixmap ()
23542355 self ["status" ] = Pixmap ()
2355- self ["message" ] = StaticText (_ ("Please wait, loading image ..." ))
2356+ self ["message" ] = StaticText (_ ("Please wait, loading picture ..." ))
23562357 self ["infolabels" ] = Label ()
23572358 text = ":\n " .join (self .exifDesc )
23582359 self .infoLabelsText = f"{ text } :"
23592360 self ["infodata" ] = Label ()
23602361 self .currentIndex = 0
23612362 self .fileList = [fileList ] if isinstance (fileList , str ) else self .makeFileList (fileList , filename )
23622363 self .fileListLen = len (self .fileList ) - 1
2363- self .displayedImage = ()
2364- self .currentImage = ()
2364+ self .displayedPicture = ()
2365+ self .currentPicture = ()
23652366 self .displayNow = True
23662367 self .displayOverlay = True
23672368 self .displayInformation = False
@@ -2421,19 +2422,19 @@ def finishDecode(self, picInfo=""):
24212422 information = []
24222423 for index in range (len (exifList )):
24232424 information .append (f"{ exifList [index ]} " )
2424- self .currentImage = (text , self .currentIndex , data , "\n " .join (information ))
2425+ self .currentPicture = (text , self .currentIndex , data , "\n " .join (information ))
24252426 self .showPicture ()
24262427
24272428 def showPicture (self ):
2428- if self .displayNow and self .currentImage :
2429+ if self .displayNow and self .currentPicture :
24292430 self .displayNow = False
2430- self ["message" ].setText (self .currentImage [0 ] if self .displayOverlay else "" )
2431- self .lastIndex = self .currentImage [1 ]
2432- self ["image" ].instance .setPixmap (self .currentImage [2 ].__deref__ ())
2431+ self ["message" ].setText (self .currentPicture [0 ] if self .displayOverlay else "" )
2432+ self .lastIndex = self .currentPicture [1 ]
2433+ self ["image" ].instance .setPixmap (self .currentPicture [2 ].__deref__ ())
24332434 self ["infolabels" ].setText (self .infoLabelsText if self .displayInformation else "" )
2434- self ["infodata" ].setText (self .currentImage [3 ] if self .displayInformation else "" )
2435- self .displayedImage = self .currentImage [:]
2436- self .currentImage = ()
2435+ self ["infodata" ].setText (self .currentPicture [3 ] if self .displayInformation else "" )
2436+ self .displayedPicture = self .currentPicture [:]
2437+ self .currentPicture = ()
24372438 self .currentIndex += 1
24382439 if self .currentIndex > self .fileListLen :
24392440 self .currentIndex = 0
@@ -2447,7 +2448,7 @@ def keyCancel(self):
24472448 def keyToggleOverlay (self ):
24482449 self .displayOverlay = not self .displayOverlay
24492450 if self .displayOverlay :
2450- self ["message" ].setText (self .displayedImage [0 ])
2451+ self ["message" ].setText (self .displayedPicture [0 ])
24512452 if self .slideshowTimer .isActive ():
24522453 self ["icon" ].show ()
24532454 else :
@@ -2458,7 +2459,7 @@ def keyToggleInformation(self):
24582459 self .displayInformation = not self .displayInformation
24592460 if self .displayInformation :
24602461 self ["infolabels" ].setText (self .infoLabelsText )
2461- self ["infodata" ].setText (self .displayedImage [3 ])
2462+ self ["infodata" ].setText (self .displayedPicture [3 ])
24622463 else :
24632464 self ["infolabels" ].setText ("" )
24642465 self ["infodata" ].setText ("" )
@@ -2472,29 +2473,29 @@ def keySlideshow(self):
24722473 self .slideshowTimer .start (config .plugins .FileCommander .slideshowDelay .value * 1000 )
24732474 if self .displayOverlay :
24742475 self ["icon" ].show ()
2475- self .keyNextImage ()
2476+ self .keyNextPicture ()
24762477
2477- def keyFirstImage (self ):
2478- self .currentImage = ()
2478+ def keyFirstPicture (self ):
2479+ self .currentPicture = ()
24792480 self .currentIndex = 0
24802481 self .startDecode ()
24812482 self .displayNow = True
24822483
2483- def keyPreviousImage (self ):
2484- self .currentImage = ()
2484+ def keyPreviousPicture (self ):
2485+ self .currentPicture = ()
24852486 self .currentIndex = self .lastIndex
24862487 self .currentIndex -= 1
24872488 if self .currentIndex < 0 :
24882489 self .currentIndex = self .fileListLen
24892490 self .startDecode ()
24902491 self .displayNow = True
24912492
2492- def keyNextImage (self ):
2493+ def keyNextPicture (self ):
24932494 self .displayNow = True
24942495 self .showPicture ()
24952496
2496- def keyLastImage (self ):
2497- self .currentImage = ()
2497+ def keyLastPicture (self ):
2498+ self .currentPicture = ()
24982499 self .currentIndex = self .fileListLen
24992500 self .startDecode ()
25002501 self .displayNow = True
0 commit comments