本文整理汇总了Python中efl.elementary.window.StandardWindow.title_set方法的典型用法代码示例。如果您正苦于以下问题:Python StandardWindow.title_set方法的具体用法?Python StandardWindow.title_set怎么用?Python StandardWindow.title_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.window.StandardWindow
的用法示例。
在下文中一共展示了StandardWindow.title_set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Interface
# 需要导入模块: from efl.elementary.window import StandardWindow [as 别名]
# 或者: from efl.elementary.window.StandardWindow import title_set [as 别名]
#.........这里部分代码省略.........
self.openFile()
it.selected_set(False)
def savePress( self, obj, it ):
self.saveFile()
it.selected_set(False)
def saveAsPress( self, obj, it ):
self.saveAs()
it.selected_set(False)
def optionsPress( self, obj, it ):
it.selected_set(False)
def copyPress( self, obj, it ):
self.mainEn.selection_copy()
it.selected_set(False)
def pastePress( self, obj, it ):
self.mainEn.selection_paste()
it.selected_set(False)
def cutPress( self, obj, it ):
self.mainEn.selection_cut()
it.selected_set(False)
def selectAllPress( self, obj, it ):
self.mainEn.select_all()
it.selected_set(False)
def textEdited( self, obj ):
ourFile = self.mainEn.file_get()[0]
if ourFile and not self.isNewFile:
self.mainWindow.title_set("*%s - ePad"%self.mainEn.file_get()[0].split("/")[len(self.mainEn.file_get()[0].split("/"))-1])
else:
self.mainWindow.title_set("*Untitlted - ePad")
self.isSaved = False
def fileSelected( self, fs, file_selected, onStartup=False ):
if not onStartup:
self.flip.go(ELM_FLIP_INTERACTION_ROTATE)
print(file_selected)
IsSave = fs.is_save_get()
if file_selected:
if IsSave:
newfile = open(file_selected,'w') # creates new file
tmp_text = self.mainEn.entry_get()
newfile.write(tmp_text)
newfile.close()
self.mainEn.file_set(file_selected, ELM_TEXT_FORMAT_PLAIN_UTF8)
self.mainEn.entry_set(tmp_text)
self.mainEn.file_save()
self.mainWindow.title_set("%s - ePad" % file_selected.split("/")[len(file_selected.split("/"))-1])
self.isSaved = True
self.isNewFile = False
else:
try:
self.mainEn.file_set(file_selected, ELM_TEXT_FORMAT_PLAIN_UTF8)
except RuntimeError:
print("Empty file: {0}".format(file_selected))
self.mainWindow.title_set("%s - ePad" % file_selected.split("/")[len(file_selected.split("/"))-1])
def aboutPress( self, obj, it ):
#About popup
self.popupAbout = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH)
self.popupAbout.text = "ePad - A simple text editor written in python and elementary<br><br> " \
示例2: Application
# 需要导入模块: from efl.elementary.window import StandardWindow [as 别名]
# 或者: from efl.elementary.window.StandardWindow import title_set [as 别名]
class Application(object):
def __init__(self):
self.cfg = ConfigOption()
self.userid = os.getuid()
self.win = None
self.bg = None
self.main_box = None
self.info_frame = None
self.lb = None
self.ps_list = None
self.win = StandardWindow("my app", "eyekill", size=(320, 384))
self.win.title_set("eye kill")
self.win.callback_delete_request_add(self.destroy)
self.main_box = Box(self.win)
self.main_box.size_hint_weight = EXPAND_BOTH
self.win.resize_object_add(self.main_box)
self.main_box.show()
self.info_frame = Frame(self.win)
self.info_frame.text_set("Information")
self.main_box.pack_end(self.info_frame)
self.info_frame.show()
self.lb = Label(self.win)
self.lb.text_set('<b>Kill process with a double click</b>')
self.info_frame.content_set(self.lb)
self.lb.show()
self.ps_list = List(self.win)
self.ps_list.size_hint_weight = EXPAND_BOTH
self.ps_list.size_hint_align = FILL_BOTH
self.ps_list.callback_clicked_double_add(self.kill_bill)
self.update_list()
self.main_box.pack_end(self.ps_list)
self.ps_list.go()
self.ps_list.show()
self.win.resize(320, 384)
self.win.show()
def destroy(self, obj):
# FIXME: but here self.cfg.save()???
elementary.exit()
def update_list(self):
if bool(self.cfg.get_desktop()):
for de in self.cfg.get_desktop():
ps = psutil.Process(get_pid_by_name(de))
pl = ps.children()
for p in pl:
if p.uids().real == self.userid:
if p.name not in self.cfg.get_process():
short_info = '%s / %s / %s' % (p.pid, p.name(), p.status())
self.ps_list.item_append(label = short_info, callback = self.update_info, p = p)
else:
pl = psutil.get_pid_list()
for p in pl:
p = psutil.Process(p)
if p.uids().real == self.userid:
if p.name() not in self.cfg.get_process():
short_info = '%s / %s / %s' % (p.pid, p.name(), p.status())
self.ps_list.item_append(label = short_info, callback = self.update_info, p = p)
def update_info(self,li , it, p):
info = ("PID %i STAT %s TIME %s<br/>MEM %s CPU %s COMMAND %s" % \
(p.pid,\
p.status(),\
p.get_cpu_times().user,\
hbytes(p.get_memory_info().rss),\
p.get_cpu_percent(interval=0),\
p.name()))
self.lb.text_set(info)
def kill_bill(self, obj, cb_data):
bill = cb_data.data_get()[1]['p'].pid
print ("%s ... Gotcha" % bill)
os.kill(bill, signal.SIGTERM)
if (os.kill(bill, 0)):
os.kill(bill, signal.SIGKILL)
item = obj.selected_item_get()
item.disabled_set(True)
示例3: Interface
# 需要导入模块: from efl.elementary.window import StandardWindow [as 别名]
# 或者: from efl.elementary.window.StandardWindow import title_set [as 别名]
#.........这里部分代码省略.........
# get linear index into current text
index = entry.cursor_pos_get()
# Replace <br /> tag with single char
# to simplify (line, col) calculation
tmp_text = entry.entry_get().replace("<br/>", "\n")
line = tmp_text[:index].count("\n") + 1
col = len(tmp_text[:index].split("\n")[-1]) + 1
# Update label text with line, col
label.text = "Ln {0} Col {1} ".format(line, col)
def textEdited(self, obj):
current_file = self.mainEn.file[0]
current_file = \
os.path.basename(current_file) if \
current_file and not self.isNewFile else \
"Untitled"
self.mainWindow.title = "*%s - ePad" % (current_file)
self.isSaved = False
def fileSelected(self, fs, file_selected, onStartup=False):
if not onStartup:
self.flip.go(ELM_FLIP_INTERACTION_ROTATE)
print(file_selected)
IsSave = fs.is_save_get()
if file_selected:
if IsSave:
newfile = open(file_selected, 'w')
tmp_text = self.mainEn.entry_get()
newfile.write(tmp_text)
newfile.close()
self.mainEn.file_set(file_selected, ELM_TEXT_FORMAT_PLAIN_UTF8)
self.mainEn.entry_set(tmp_text)
self.mainEn.file_save()
self.mainWindow.title_set("%s - ePad"
% os.path.basename(file_selected))
self.isSaved = True
self.isNewFile = False
else:
try:
self.mainEn.file_set(file_selected,
ELM_TEXT_FORMAT_PLAIN_UTF8)
except RuntimeError:
print("Empty file: {0}".format(file_selected))
self.mainWindow.title_set("%s - ePad"
% os.path.basename(file_selected))
def newFile(self, obj=None, ignoreSave=False):
if self.isSaved is True or ignoreSave is True:
trans = Transit()
trans.object_add(self.mainEn)
trans.auto_reverse = True
trans.effect_wipe_add(
ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT)
trans.duration = 0.5
trans.go()
time.sleep(0.5)
self.mainWindow.title_set("Untitled - ePad")
self.mainEn.delete()
self.entryInit()
self.isNewFile = True
elif self.confirmPopup is None:
示例4: Interface
# 需要导入模块: from efl.elementary.window import StandardWindow [as 别名]
# 或者: from efl.elementary.window.StandardWindow import title_set [as 别名]
#.........这里部分代码省略.........
def textEdited(self, obj):
current_file = self.mainEn.file[0]
current_file = \
os.path.basename(current_file) if \
current_file and not self.isNewFile else \
"Untitled"
self.mainWindow.title = "*%s - ePad" % (current_file)
self.isSaved = False
def newFile(self, obj=None, ignoreSave=False):
if self.newInstance:
# sh does not properly handle space between -d and path
command = "epad -d'{0}'".format(self.lastDir)
print("Launching new instance: {0}".format(command))
ecore.Exe(command, ecore.ECORE_EXE_PIPE_READ |
ecore.ECORE_EXE_PIPE_ERROR | ecore.ECORE_EXE_PIPE_WRITE)
return
if self.isSaved is True or ignoreSave is True:
trans = Transit()
trans.object_add(self.mainEn)
trans.auto_reverse = True
trans.effect_wipe_add(
ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT)
trans.duration = 0.5
trans.go()
time.sleep(0.5)
self.mainWindow.title_set("Untitled - ePad")
self.mainEn.delete()
self.entryInit()
self.isNewFile = True
elif self.confirmPopup is None:
self.confirmSave(self.newFile)
self.mainEn.focus_set(True)
def openFile(self, obj=None, ignoreSave=False):
if self.isSaved is True or ignoreSave is True:
self.fileSelector.is_save_set(False)
self.fileLabel.text = "<b>Select a text file to open:</b>"
self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)
elif self.confirmPopup is None:
self.confirmSave(self.openFile)
def confirmSave(self, ourCallback=None):
self.confirmPopup = Popup(self.mainWindow,
size_hint_weight=EXPAND_BOTH)
self.confirmPopup.part_text_set("title,text", "File Unsaved")
current_file = self.mainEn.file[0]
current_file = \
os.path.basename(current_file) if current_file else "Untitled"
self.confirmPopup.text = "Save changes to '%s'?" % (current_file)
# Close without saving button
no_btt = Button(self.mainWindow)
no_btt.text = "No"
no_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
if ourCallback is not None:
no_btt.callback_clicked_add(ourCallback, True)
no_btt.show()
# cancel close request