本文整理汇总了Python中util.Util.create_info_label方法的典型用法代码示例。如果您正苦于以下问题:Python Util.create_info_label方法的具体用法?Python Util.create_info_label怎么用?Python Util.create_info_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Util
的用法示例。
在下文中一共展示了Util.create_info_label方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_grid
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import create_info_label [as 别名]
def build_grid(self):
permissions_header = Util.create_label("<big>PERMISSIONS</big>",
align=Gtk.Align.START)
permissions_header.set_use_markup(True)
self.attach(permissions_header, 0, 0, 1, 1)
# create attribute labels
owner_label = Util.create_label("Owner:")
group_label = Util.create_label("Group:")
perms_label = Util.create_info_label(
Util.create_perm_str(self._filestat.st_mode),
align=Gtk.Align.END)
# create attribute values
owner = Util.create_info_label(self._owner_name)
group = Util.create_info_label(self._group_name)
# Entry box
perms_entry = Gtk.Entry.new()
perms_entry.set_max_length(3)
perms_entry.set_width_chars(3)
perms_entry.set_text(Util.create_777_format(self._filestat.st_mode))
perms_entry.connect("changed", self.on_perms_changed, perms_label)
self.attach(owner_label, 0, 1, 1, 1)
self.attach(group_label, 0, 2, 1, 1)
self.attach(perms_label, 0, 3, 1, 1)
self.attach(owner, 1, 1, 1, 1)
self.attach(group, 1, 2, 1, 1)
self.attach(perms_entry, 1, 3, 1, 1)
示例2: create_grid
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import create_info_label [as 别名]
def create_grid(self):
general_header = Util.create_label("<big>GENERAL</big>",
align=Gtk.Align.START)
general_header.set_use_markup(True)
self.attach(general_header, 0, 0, 1, 1)
# create attribute labels
filename_label = Util.create_label("Name:")
filesize_label = Util.create_label("Filesize:")
location_label = Util.create_label("Location:")
last_modified_label = Util.create_label("Last Modified:")
last_access_label = Util.create_label("Last Access:")
# create attribute values
filename = Util.create_info_label(os.path.basename(self._filepath))
filesize = self.file_or_folder_size_widget()
location = Util.create_info_label(os.path.dirname(self._filepath), ellipsize=True)
last_modified = Util.create_info_label(time.ctime(self._filestat.st_mtime))
last_access = Util.create_info_label(time.ctime(self._filestat.st_atime))
# add all widgets to the grid
self.attach(filename_label, 0, 1, 1, 1)
self.attach(filename, 1, 1, 1, 1)
self.attach(filesize_label, 0, 2, 1, 1)
self.attach(filesize, 1, 2, 1, 1)
self.attach(location_label, 0, 3, 1, 1)
self.attach(location, 1, 3, 1, 1)
self.attach(last_modified_label, 0, 4, 1, 1)
self.attach(last_modified, 1, 4, 1, 1)
self.attach(last_access_label, 0, 5, 1, 1)
self.attach(last_access, 1, 5, 1, 1)
示例3: generate_git_info
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import create_info_label [as 别名]
def generate_git_info(self, grid, filepath):
repo = Repository(filepath)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5)
git_label = Util.create_label("<big>Git Repository Information</big>",
align=Gtk.Align.START)
git_label.set_use_markup(True)
vbox.pack_start(git_label, False, False, 0)
# Current branch name
cur_branch_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
cur_branch_label = Util.create_label("Current Branch: ")
cur_branch_name = Util.create_info_label(repo.get_cur_branch())
cur_branch_hbox.pack_start(cur_branch_label, False, False, 1)
cur_branch_hbox.pack_start(cur_branch_name, False, False, 1)
vbox.pack_start(cur_branch_hbox, False, False, 1)
# branch list combo box
branch_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
branches_label = Util.create_label("All Branches: ")
branch_hbox.pack_start(branches_label, False, False, 1)
branch_combo = Gtk.ComboBox.new_with_model(repo.branch_list_store())
renderer_text = Gtk.CellRendererText()
branch_combo.pack_start(renderer_text, True)
branch_combo.add_attribute(renderer_text, "text", 0)
branch_hbox.pack_start(branch_combo, False, False, 1)
vbox.pack_start(branch_hbox, False, False, 1)
# total commits
count_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
count_label = Util.create_label("Total Commits:")
count_hbox.pack_start(count_label, False, False, 1)
count_entry = Gtk.Entry()
count_entry. set_max_length(4)
count_entry.set_width_chars(4)
count_entry.set_text(str(repo.commit_count()))
count_entry.set_editable(False)
count_hbox.pack_start(count_entry, False, False, 1)
vbox.pack_start(count_hbox, False, False, 1)
# status and branch creation button
git_button_box = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL)
git_button_box.set_layout(Gtk.ButtonBoxStyle.START)
status_btn = Gtk.Button(label="Git Status")
create_branch_btn = Gtk.Button.new_with_label("Create Branch")
status_btn.connect("clicked", self.create_git_status_tab, repo)
create_branch_btn.connect("clicked", self.on_click_create_branch, repo)
git_button_box.pack_start(status_btn, False, False, 0)
git_button_box.pack_start(create_branch_btn, False, False, 0)
vbox.pack_start(git_button_box, False, False, 0)
# add vbox to the grid
grid.attach(vbox, 0, 4, 1, 1)
示例4: file_or_folder_size_widget
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import create_info_label [as 别名]
def file_or_folder_size_widget(self):
if os.path.isdir(self._filepath):
btn_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
filesize = Gtk.Button(label="Calculate")
filesize.connect("clicked", self.on_clicked_filesize_button)
filesize.set_tooltip_text("Click to calculate")
filesize.set_hexpand(False)
btn_box.pack_start(filesize, False, False, 0)
return btn_box
else:
size_of_file = str(Util.get_filesize_format(self._filestat.st_size))
filesize = Util.create_info_label(size_of_file)
filesize.set_size_request(50, 30)
return filesize