Programming Freaks  | دورات ومقالات برمجيه

Please login or register.

Login with username, password and session length
Advanced search  

News:

Please Read our FAQ

Author Topic: مشكلة في nautilus-pyextensions  (Read 700 times)

KodeBurner

  • [ GFX Designer | PHP Programmer ]
  • Just Joined
  • *
  • Posts: 11
  • [ Some One ]
    • View Profile
    • Email
مشكلة في nautilus-pyextensions
« on: March 07, 2009, 01:00:51 AM »

سلام يا جماعة

من المعروف انا بدات بالانتقال لبرمجة بايثون "عاوز يبقى بايثوناوي" لكن قلت لازم أبدأ بحاجة تشرف :D .. المهم بدأت اكتب سكربتات بايثوناوية لناوتيليس و قلت لازم أركب  nautilus-pyextensions

<< همه جنوم و بس عاوزها تبقى أجمل

بس بعد ما نزلت السورس بتاع ناوتيليس باي إكستينشن و قلت أجربه

طلع لي الخطأ ده

و للعلم دا أول خطا يحصلي مع بايثون :(

دي الرسالة اللي طالعة


Code: [Select]
kody@marsplanet:~$ nautilus-pyextensions
Traceback (most recent call last):
  File "/usr/bin/nautilus-pyextensions", line 370, in <module>
    if __name__ == "__main__": main()
  File "/usr/bin/nautilus-pyextensions", line 365, in main
    store = InfoModel()
  File "/usr/bin/nautilus-pyextensions", line 46, in __init__
    icon_path = self.get_icon_path(self.get_icon_name(pyextension_path))
  File "/usr/bin/nautilus-pyextensions", line 85, in get_icon_name
    return match.group(0)
AttributeError: 'NoneType' object has no attribute 'group'
kody@marsplanet:~$

و أتأكدت من الحزم اللي مركبها و برضو ما فيش فايدة

أنا شاكك بالبرنامج إحتمال ما يشتغلش على منصات 64 بت ؟

و عفوأ لو زودت عليكم :(

« Last Edit: March 07, 2009, 02:15:00 AM by KodeBurner »
Logged
-
The Exciting World Is That World Full Of Technology
-
Microsoft Is Not The Answer. Microsoft Is The Question. NO ( Or Linux ) Is The Answer

KodeBurner

  • [ GFX Designer | PHP Programmer ]
  • Just Joined
  • *
  • Posts: 11
  • [ Some One ]
    • View Profile
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #1 on: March 07, 2009, 08:19:14 PM »
There is a bug in the 64 bit version ..  :-[ am sorry

I sent the bug to the team :|

They will fix this bug as soon as possible ..

Logged
-
The Exciting World Is That World Full Of Technology
-
Microsoft Is Not The Answer. Microsoft Is The Question. NO ( Or Linux ) Is The Answer

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #2 on: March 07, 2009, 08:28:39 PM »
مش متعود على تطبيقات Gnome بس شكل المشكلة مع الأيكونات

ممكن تعدل الكود فى الميثودز دى كالتالى وتديلى ناتج التشغيل ؟
Code: [Select]
	def get_icon_name(self, pyextension_path):
"""Returns the name of the icon associated to the given pyextension"""
pyextension_file = open(pyextension_path, 'r')
pyextension_file_string = pyextension_file.read()
pyextension_file.close()
# regular expression: search for a string preceeded by "'NautilusPython::" and followed by "'"
match = re.search("(?<='NautilusPython::).*?(?=')", pyextension_file_string)
if match == None:
match = re.search('(?<="NautilusPython::).*?(?=")', pyextension_file_string)
if match:
    return match.group(0)
return None


def get_icon_path(self, icon_name):
"""Returns the path of the icon from the icon name"""
try:
    for dirpath, dirnames, filenames in os.walk('/usr/share/icons/hicolor'):
    for filename in filenames:
    if os.path.splitext(filename)[0] == icon_name:
    print "Found: ", icon_name
    return os.path.join(dirpath, filename)
    for dirpath, dirnames, filenames in os.walk('/usr/share/icons/gnome'):
    for filename in filenames:
    if os.path.splitext(filename)[0] == icon_name:
    print "Found: ", icon_name
    return os.path.join(dirpath, filename)
except: return None
المفروض ان لو اسم الأيكون مش موجود فى  ملف ال extension بصورة مشابهة للمقطع دا NautilusPython::audacious ومش موجودة فى مسارات الأيكونات يتعمل لود لأيكون الإيرور /usr/share/icons/gnome/24x24/status/gtk-dialog-error.png
Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

KodeBurner

  • [ GFX Designer | PHP Programmer ]
  • Just Joined
  • *
  • Posts: 11
  • [ Some One ]
    • View Profile
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #3 on: March 07, 2009, 08:30:56 PM »
هجرب و أشوف .. ..

Logged
-
The Exciting World Is That World Full Of Technology
-
Microsoft Is Not The Answer. Microsoft Is The Question. NO ( Or Linux ) Is The Answer

KodeBurner

  • [ GFX Designer | PHP Programmer ]
  • Just Joined
  • *
  • Posts: 11
  • [ Some One ]
    • View Profile
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #4 on: March 07, 2009, 08:37:07 PM »

الف شكر أحمد اشتغلت ..

و دي المخرجات ..

و الرجاء و تشرح لي المشكلة ايه

للعلم أنا لسه مبتدئ .. رجاء أعذرني

Code: [Select]
kody@marsplanet:~/untitled/nautilus-pyextensions_0.2$ ./nautilus-pyextensions
Found:  terminal
Found:  gtk-copy
Found:  preferences-desktop-wallpaper
./nautilus-pyextensions:150: GtkWarning: Theme directory 32x32/emotexs of theme Aqua-Glade_PNG has no size field

  self.window.show_all()
Logged
-
The Exciting World Is That World Full Of Technology
-
Microsoft Is Not The Answer. Microsoft Is The Question. NO ( Or Linux ) Is The Answer

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #5 on: March 07, 2009, 08:48:29 PM »
تكرم ياجميل
بص احنا محتاجين عمود فيه ايكون بتعبر عن ال extension صح ؟
الأيكون دى بتبقة مذكور اسمها فى ملف ال extension مثلا فى ملف audacious كان اسمها مكتوب كالتالى NautilusPython::audacious
بعد كدا السطر دا
Code: [Select]
    icon_path = self.get_icon_path(self.get_icon_name(pyextension_path))

Code: [Select]
	
match = re.search('(?<="NautilusPython::).*?(?=")', pyextension_file_string)
return match.group(0)
مش بيعمل تشيك هل فعلا اتوجد match او لأ فى المرة التانية لأنها لو مش موجود هيكون None وال None مش ليه group method تقدر تستدعيها فكل اللى عملته انى شيكت وعملت return ب None
وبعد كدا الميثود get_icon_path هتدى ريترن ب None فدا هيستوجب استخدام الأيكون الإفتراضية  /usr/share/icons/gnome/24x24/status/gtk-dialog-error.png

دا التعديل النهائى بدل تكرار الكود
Code: [Select]
	def get_icon_name(self, pyextension_path):
"""Returns the name of the icon associated to the given pyextension"""
pyextension_file = open(pyextension_path, 'r')
pyextension_file_string = pyextension_file.read()
pyextension_file.close()
# regular expression: search for a string preceeded by "'NautilusPython::" and followed by "'"
match = re.search("(?<=['\"]NautilusPython::).*?(?=['\"])", pyextension_file_string)
return match.group(0) if match else None


def get_icon_path(self, icon_name):
"""Returns the path of the icon from the icon name"""
for dirpath, dirnames, filenames in os.walk('/usr/share/icons/hicolor'):
for filename in filenames:
if os.path.splitext(filename)[0] == icon_name:
return os.path.join(dirpath, filename)
for dirpath, dirnames, filenames in os.walk('/usr/share/icons/gnome'):
for filename in filenames:
if os.path.splitext(filename)[0] == icon_name:
return os.path.join(dirpath, filename)
return None
وتحت امرك
« Last Edit: March 08, 2009, 04:48:10 PM by Ahmed Youssef »
Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

KodeBurner

  • [ GFX Designer | PHP Programmer ]
  • Just Joined
  • *
  • Posts: 11
  • [ Some One ]
    • View Profile
    • Email
Re: مشكلة في nautilus-pyextensions
« Reply #6 on: March 07, 2009, 08:54:25 PM »

الف الف شكر يا أحمد

شرح سلس جداً

الله يبارك فيك

بعد ما اتعود على بايثون شوية رح أستفسرك أكثر ..

أصلاً دفنت نفسي في الويب كتير و نسيت حاجات كتير متل السي و أخواتها ..

ألف شكر مرة تانية

Logged
-
The Exciting World Is That World Full Of Technology
-
Microsoft Is Not The Answer. Microsoft Is The Question. NO ( Or Linux ) Is The Answer