def __check_beautify_last_updated_timestamp(self, now_seconds, expected):
     with mock.patch.object(time, "time"):
         time.time.return_value = now_seconds
         with mock.patch.object(time, "localtime"):
             # Mock to use UTC, so that weekday naming is not timezone dependent.
             previously_seconds = 0
             time.localtime.return_value = time.gmtime(previously_seconds)
             self.assertEqual(
                 beautify_last_updated_timestamp(previously_seconds),
                 expected)
    def __init__(self, recent_project_item):
        Gtk.ListBoxRow.__init__(self)
        self.uri = recent_project_item.get_uri()
        self.name = os.path.splitext(recent_project_item.get_display_name())[0]

        builder = Gtk.Builder()
        builder.add_from_file(os.path.join(get_ui_dir(), "project_info.ui"))
        self.add(builder.get_object("project_info_tophbox"))

        self.select_button = builder.get_object("project_select_button")
        # Hide the select button as we only want to
        # show it during projects removal screen.
        self.select_button.hide()

        builder.get_object("project_name_label").set_text(self.name)
        builder.get_object("project_uri_label").set_text(
            beautify_project_path(recent_project_item.get_uri_display()))
        builder.get_object("project_last_updated_label").set_text(
            beautify_last_updated_timestamp(recent_project_item.get_modified()))
Exemple #3
0
    def __init__(self, recent_project_item):
        Gtk.ListBoxRow.__init__(self)
        self.uri = recent_project_item.get_uri()
        self.name = os.path.splitext(recent_project_item.get_display_name())[0]

        builder = Gtk.Builder()
        builder.add_from_file(os.path.join(get_ui_dir(), "project_info.ui"))
        self.add(builder.get_object("project_info_tophbox"))

        self.select_button = builder.get_object("project_select_button")
        # Hide the select button as we only want to
        # show it during projects removal screen.
        self.select_button.hide()

        self.__thumb = builder.get_object("project_thumbnail")
        # Defer loading of thumbnail.
        GLib.idle_add(self.__load_thumb_cb)

        builder.get_object("project_name_label").set_text(self.name)
        builder.get_object("project_uri_label").set_text(
            beautify_project_path(recent_project_item.get_uri_display()))
        builder.get_object("project_last_updated_label").set_text(
            beautify_last_updated_timestamp(recent_project_item.get_modified()))
Exemple #4
0
 def __check_beautify_last_updated_timestamp(self, seconds, expected):
     time.time = Mock()
     time.time.return_value = seconds
     self.assertEqual(beautify_last_updated_timestamp(0), expected)
Exemple #5
0
 def __check_beautify_last_updated_timestamp(self, seconds, expected):
     time.time = Mock()
     time.time.return_value = seconds
     self.assertEqual(beautify_last_updated_timestamp(0), expected)