Ejemplo n.º 1
0
 def generate_commandlist(self):
     """Generate a list of internal vimiv commands and store it."""
     commands = list(self.app.commands.keys())
     aliases = list(self.app.aliases.keys())
     all_commands = sorted(commands + aliases)
     infodict = read_info_from_man()
     for command in all_commands:
         if command in infodict.keys():
             info = infodict[command]
         elif command in self.app.aliases:
             info = "Alias to " + self.app.aliases[command]
         else:
             info = ""
         info = "<i>" + info + "</i>"
         self.liststores["internal"][0].append([command, info])
Ejemplo n.º 2
0
 def generate_commandlist(self):
     """Generate a list of internal vimiv commands and store it."""
     commands = [cmd.name for cmd in self._app["commandline"].commands
                 if not cmd.is_hidden]
     aliases = list(self._app["commandline"].commands.aliases.keys())
     all_commands = sorted(commands + aliases)
     infodict = read_info_from_man()
     for command in all_commands:
         if command in infodict:
             info = infodict[command]
         elif command in aliases:
             info = "Alias to %s" % (
                 self._app["commandline"].commands.aliases[command])
         else:
             info = ""
         info = "<i>" + GLib.markup_escape_text(info) + "</i>"
         self._liststores["internal"][0].append([command, info])
Ejemplo n.º 3
0
 def generate_commandlist(self):
     """Generate a list of internal vimiv commands and store it."""
     commands = [cmd for cmd in self.app["commands"]
                 if not self.app["commands"][cmd]["is_hidden"]]
     aliases = list(self.app.aliases.keys())
     all_commands = sorted(commands + aliases)
     infodict = read_info_from_man()
     for command in all_commands:
         if command in infodict:
             info = infodict[command]
         elif command in self.app.aliases:
             info = "Alias to " + self.app.aliases[command]
             # Escape ampersand for Gtk
             info = info.replace("&", "&amp;")
         else:
             info = ""
         info = "<i>" + info + "</i>"
         self.liststores["internal"][0].append([command, info])
Ejemplo n.º 4
0
 def test_read_info_from_man(self):
     """Read command information from the vimiv man page."""
     infodict = helpers.read_info_from_man()
     # Check if some keys exist
     self.assertIn("set", infodict)
     self.assertIn("center", infodict)
     # Check if the first sentence is added correctly
     # Simple
     center_info = infodict["center"]
     self.assertEqual(center_info, "Scroll to the center of the image")
     # On two lines
     autorot_info = infodict["autorotate"]
     self.assertEqual(
         autorot_info,
         "Rotate all images in the current filelist according to exif data")
     # Containing extra periods
     # TODO reactivate if this case re-appears
     # More than one sentence
     flip_info = infodict["flip"]
     self.assertEqual(flip_info, "Flip the current image")
Ejemplo n.º 5
0
 def test_read_info_from_man(self):
     """Read command information from the vimiv man page."""
     infodict = helpers.read_info_from_man()
     # Check if some keys exist
     self.assertIn("set brightness", infodict)
     self.assertIn("center", infodict)
     # Check if the first sentence is added correctly
     # Simple
     center_info = infodict["center"]
     self.assertEqual(center_info, "Scroll to the center of the image")
     # On two lines
     autorot_info = infodict["autorotate"]
     self.assertEqual(
         autorot_info,
         "Rotate all images in the current filelist according to EXIF data")
     # Containing extra periods
     trash_info = infodict["clear_trash"]
     self.assertEqual(trash_info, "Delete all files in ~/.vimiv/Trash")
     # More than one sentence
     flip_info = infodict["flip"]
     self.assertEqual(flip_info, "Flip the image")