192
192
return global_data["plugins"][activate_plugin_index]
194
#function to get info from mode
195
def get_mode_info(mode):
196
aperms = {"USR":[], "GRP":[], "OTH":[]}
197
mode=stat.S_IMODE(mode)
198
for who in "USR", "GRP", "OTH":
199
for what in "R", "W", "X":
200
if mode & getattr(stat,"S_I"+what+who):
201
aperms[who].append(what.lower())
205
def get_permisson_info(path):
206
if not os.path.exists(path):
209
stat_info=os.lstat(path)
212
perms, colour, link = get_mode_info(stat_info.st_mode)
215
name = pwd.getpwuid(stat_info.st_uid)[0]
217
name = stat_info.st_uid
219
group = grp.getgrgid(stat_info.st_gid)[0]
221
group = stat_info.st_gid
222
info = get_mode_info(stat_info.st_mode)
223
return [name, group, info]
227
def has_permissions(path):
228
info = get_permisson_info(path)
229
currentName = os.getlogin()
230
if currentName == info[0] and ["r","w","x"] == info[2]["USR"]:
232
elif currentName == info[2] and ["r","w", "x"] == info[2]["GRP"]:
234
elif ["r","w", "x"] == info[2]["OTH"]:
194
240
def on_execute_clicked(widget, data, wtree):
195
241
global global_data
197
243
# check if a glade file and a plugin is chosen
198
244
c1 = wtree.get_widget("output_directory_chooser").get_filename()
199
246
c2 = wtree.get_widget("glade_file_chooser").get_filename()
200
247
if None in [c1, c2]:
201
show_message("please choose a glade file",True)
248
show_message("Please choose a glade file",True)
252
if not has_permissions(c1):
253
show_message("ERROR: Insufficient permission.\n Please change output directory.",False)
205
256
# calls execute function from plugin
206
257
plug = get_selected_plugin()