انجمن‌های فارسی اوبونتو

لطفاً به انجمن‌ها وارد شده و یا جهت ورود ثبت‌نام نمائید

لطفاً جهت ورود نام کاربری و رمز عبورتان را وارد نمائید


ارائه ۲۵٫۰۴ اوبونتو منتشر شد 🎉

نویسنده موضوع: چگونه فایل deb بسازیم؟؟؟؟  (دفعات بازدید: 929 بار)

0 کاربر و 1 مهمان درحال مشاهده موضوع.

آفلاین Hostile

  • Jr. Member
  • *
  • ارسال: 51
  • جنسیت : پسر
  • زنده باد زندگی
چگونه فایل deb بسازیم؟؟؟؟
« : 01 تیر 1393، 01:46 ق‌ظ »
سلام دوستان
من چنوقت پیش  نیاز پیدا کردم که یه عکس رو تغییر اندازه بدم!
برنامه ای که جالب باشه پیدا نکردم برای همین خودم دست بکار شدم و یک برنامه به زبان پایتون ساختم!
حالا اومدم اینو گسترش دادم و قابلیت Rotate هم بهش اضافه کردم!
به فکرم رسید اینرو به یک فایل deb تبدیل کنم که بقیه راحت نصب کنم و نیاز به ماژول هایی که استقاده کردم نداشته باشن!
چطور میتونم این کارو انجام بدم ؟؟
و همینطور چطور میتونم به software center  انتقال بدم ؟؟
ممنون میشم کمک کنین!
 این هم کد :
#!/usr/bin/env python

# -*- coding utf-8 -*-


####################################################
#Image Resizer                                     #
#Copyright 2014 By Hostile                         #
#Allrights Recived                                 #
#This is free and opensource                       #
#This application use WxPython For User Interface  #
#Use Python for base                               #
#and Use PIL (Python Imaging Library) for resizing #
#I'm a beginner programmer from Iran               #
#and i will be the best in the world               #
#Good Luck                                         #
#Conncet With Me on Yahoo                          #     
#Encoder301@yahoo.com                              #
####################################################

from __future__ import division

import Image

import wx

import sys

import os


description = """Image Resizer is Simple Image Size Manager and Rotater for

the Unix operating system.

Image Resizer made in Python Programming Language

and  use wxPython for UI and PIL for Images

Authors : Hostile , Aminasa
"""


licence = """
Image Resizer is free software; you can redistribute

it and/or modify it under the terms of the GNU General Public License as

published by the Free Software Foundation; either version 2 of the License,

or (at your option) any later version.


Image Resizer is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

See the GNU General Public License for more details. You should have

received a copy of the GNU General Public License along with Image Resizer;

if not, write to the Free Software Foundation,

Contact me : Encoder301@yahoo.com

"""


app=wx.App()

wildcard="JPEG , GIF , PNG , ICO , BMP , IMG|*.jpg;*.jpeg;*.gif;*.png;*.ico;*.bmp;*.img|"

icon=wx.Icon("ico.ico",wx.BITMAP_TYPE_ICO)

#on Linux

os.chdir("/home")

class Main(wx.Frame):
   
    lst=[]
   
    def __init__(self):
       
        super(Main,self).__init__(None,title="Image Resizer",style=
        wx.DEFAULT_FRAME_STYLE^wx.RESIZE_BORDER^wx.MAXIMIZE_BOX)
       
        self.Center()
       
        self.SetSize((400,390))
       
        self.Show()
       
        self.CreateStatusBar()
       
        self.parent=self
       
        self.panel=wx.Panel(self)
       
        self.SetIcon(icon)
       
        #Statusbar part
       
        self.CreateStatusBar()
       
        #Menubar part
       
        menubar=wx.MenuBar()
       
        menu=wx.Menu()
       
        menu2=wx.Menu()
       
        menu3=wx.Menu()
       
        mo1=menu3.AppendRadioItem(wx.ID_ANY,"Resize mode","Resize an Image")
       
        mo2=menu3.AppendRadioItem(wx.ID_ANY,"Rotate mode","Rotate an Image")
       
        self.Bind(wx.EVT_MENU,self.add1,mo1)
       
        self.Bind(wx.EVT_MENU,self.add2,mo2)
       
        m1=menu.Append(wx.ID_OPEN,"Input File","Open an image for resizing")
       
        m2=menu.Append(wx.ID_ANY,"Output File","Choose an file for output")
       
        menu.AppendSeparator()
       
        m4=menu.Append(wx.ID_ANY,"Start","Start resize")
       
        menu.AppendSeparator()
       
        m3=menu.Append(wx.ID_EXIT,"Exit","Close Program")
             
        item3=menu2.Append(wx.ID_FILE1,"About","Little About Program")
       
        self.Bind(wx.EVT_MENU,self.aboutme,item3)
       
        self.Bind(wx.EVT_MENU,self.onclose,m3)
       
        self.Bind(wx.EVT_MENU,self.load,m1)
       
        self.Bind(wx.EVT_MENU,self.choose,m2)
       
        self.Bind(wx.EVT_MENU,self.start,m4)
       
        self.Bind(wx.EVT_CLOSE,self.onclose)
       
       
        menubar.Append(menu,"&File")
       
        menubar.Append(menu3,"&Options")
       
        menubar.Append(menu2,"&About")
       
       
        self.SetMenuBar(menubar)
       
        #MenuBar Part Ended !!!!!       
       
        line1=wx.StaticLine(self.panel,pos=(5,112),size=(390,2))
       
        line2=wx.StaticLine(self.panel,pos=(5,224),size=(390,2))
       
        box1=wx.StaticBox(self.panel,size=(390,100),pos=(5,5),label="Input File")
       
        txt=wx.StaticText(self.panel,label="Choos Your Input File From Menubar",pos=(20,25))
       
        txt4=wx.StaticText(self.panel,label="Choos Your Output File From Menubar",pos=(20,255))
       
        self.input=wx.TextCtrl(self.panel,size=(340,25),pos=(25,60),style=wx.TE_READONLY)
       
       
        box2=wx.StaticBox(self.panel,size=(390,100),pos=(5,115),label="Options")
       
        box3=wx.StaticBox(self.panel,size=(390,100),pos=(5,230),label="Output File")
       
        self.input.SetToolTip(wx.ToolTip("Please choose input file from Menubar"))
       
        self.out=wx.TextCtrl(self.panel,size=(340,25),pos=(25,280),style=wx.TE_READONLY)
       
       
        self.out.SetToolTip(wx.ToolTip("Please choose output file from Menubar"))
       
        txt2=wx.StaticText(self.panel,pos=(20,135),label="Output File Width : ")
       
        txt3=wx.StaticText(self.panel,pos=(20,160),label="Output File Height : ")
       
        txt4=wx.StaticText(self.panel,pos=(20,185),label="Rotate Degrees : ")
       
        self.spin1=wx.SpinCtrl(self.panel,value="100",max=8000,min=1,pos=(140,133),size=(80,20))
       
        self.spin2=wx.SpinCtrl(self.panel,value="100",max=8000,min=1,pos=(140,158),size=(80,20))
       
        self.spin3=wx.SpinCtrl(self.panel,value="90",max=360,min=-360,pos=(140,183),size=(80,20))
       
        self.spin3.Disable()
       
        self.spin2.Disable()
       
        self.spin1.Disable()
       
        self.spin1.SetToolTip(wx.ToolTip("Choose Option From Menubar First"))
       
        self.spin2.SetToolTip(wx.ToolTip("Choose Option From Menubar First"))
       
        self.spin3.SetToolTip(wx.ToolTip("Choose Option From Menubar First"))
       
        self.SetStatusText("No Input File")
       
    def aboutme(self,event):
       
        info = wx.AboutDialogInfo()
       
        info.SetIcon(icon)
       
        info.SetName('Image Resizer')
       
        info.SetVersion('1.0')
       
        info.SetDescription(description)
       
        info.SetCopyright('(C) 2014 By Hostile , Aminasa')
       
        info.SetLicence(licence)
       
        wx.AboutBox(info)
       
    def load(self,event):
       
        inf=wx.FileDialog(self,message="Select Your Image",defaultDir=os.getcwd(),wildcard=wildcard,style=wx.OPEN)

        inf.Show()       
       
        if inf.ShowModal()==wx.ID_OK:
                                               
            inp=inf.GetPath()
           
            self.input.SetValue(str(inp))
           
            byte=os.path.getsize(inp)
           
           
           
            self.SetStatusText("Input File Size : "+str(byte/1024)[0:5]+" KB")
           
       
    def choose(self,event):
       
        ino=wx.FileDialog(self,message="Select Your Image",defaultDir=os.getcwd(),wildcard=wildcard,style=wx.SAVE)

        ino.Show()       
       
        if ino.ShowModal()==wx.ID_OK:
                                               
            inp=ino.GetPath()
           
            self.out.SetValue(str(inp))
         
    def start(self,event):
       
        try:
                   
            if self.lst[0]=="re":
           
                self.startresize()
           
            else:
           
                self.startrotate()
        except:
           
            wx.MessageBox("Choose Option From Menu First","Error",parent=self,style=wx.ICON_ERROR)
   
    def startrotate(self):
       
        if self.input.GetValue()=="":
           
            wx.MessageBox("No Input File      ","Error",parent=self)
           
        elif self.out.GetValue()=="":
           
            wx.MessageBox("No Output File     ","Error",parent=self)
           
        else:
           
            try:
               
                img=Image.open(str(self.input.GetValue()))
               
                d=int(self.spin3.GetValue())
               
                new=img.rotate(d)
               
                new.save((self.out.GetValue()))
               
                wx.MessageBox("Completed!!\nEnjoy! :)                 ","Complet",parent=self)
               
            except:
               
               wx.MessageBox("An Error Raised\nTry Again             ","Error",parent=self)
   
    def startresize(self):
       
        if self.input.GetValue()=="":
           
            wx.MessageBox("No Input File      ","Error",parent=self)
           
        elif self.out.GetValue()=="":
           
            wx.MessageBox("No Output File     ","Error",parent=self)
        else:
            try:
                img=Image.open(str(self.input.GetValue()))
               
                w=int(self.spin1.GetValue())
               
                h=int(self.spin2.GetValue())
               
                new=img.resize((w,h))
               
                new.save((self.out.GetValue()))
               
                wx.MessageBox("Completed!!\nEnjoy! :)                 ","Complet",parent=self)
           
            except:
               
               wx.MessageBox("An Error Raised\nTry Again             ","Error",parent=self)
               
    def onclose(self,event):
        warning=wx.MessageDialog(message="Are You Sure You Want To Exit?",caption="Warning",
                                 parent=self,style=wx.ICON_WARNING | wx.YES_NO | wx.NO_DEFAULT)
                                 
        ans=warning.ShowModal()
       
        if ans==wx.ID_YES:
           
            self.Destroy()
           
            sys.exit()
           
        else:
           
            event.Veto()
           
    def add1(self,event):
       
        self.spin1.Enable()
       
        self.spin2.Enable()
       
        self.spin3.Disable()
       
        self.spin1.SetToolTip(wx.ToolTip("This is width size"))
       
        self.spin2.SetToolTip(wx.ToolTip("This is height size"))
       
        self.spin3.SetToolTip(wx.ToolTip("This is degrees for rotate"))
       
        del self.lst[:]
       
        self.lst.append("re")
       
    def add2(self,event):
       
        self.spin1.Disable()
       
        self.spin2.Disable()
       
        self.spin3.Enable()
       
        self.spin1.SetToolTip(wx.ToolTip("This is width size"))
       
        self.spin2.SetToolTip(wx.ToolTip("This is height size"))
       
        self.spin3.SetToolTip(wx.ToolTip("This is degrees for rotate"))

        del self.lst[:]
       
        self.lst.append("ro")
       
MaineFrame=Main()

app.MainLoop()
       
       
       
       

باشه باشه تماس میگیرم

آفلاین سلمان م.

  • ناظر انجمن
  • *
  • ارسال: 4106
  • جنسیت : پسر
  • GNU Operating System - سیستم عامل گنو
پاسخ : چگونه فایل deb بسازیم؟؟؟؟
« پاسخ #1 : 01 تیر 1393، 01:56 ق‌ظ »
باید زیاد بخونی.
https://wiki.debian.org/Packaging

پیشنهاد اوبونتو این هست که بسته‌هاتون رو برای دبیان بفرستید تا بعد به صورت خودکار وارد مخازن اوبونتو بشه.

آفلاین Hostile

  • Jr. Member
  • *
  • ارسال: 51
  • جنسیت : پسر
  • زنده باد زندگی
پاسخ : چگونه فایل deb بسازیم؟؟؟؟
« پاسخ #2 : 01 تیر 1393، 02:22 ق‌ظ »
خودم اصلا نمیتونم فایل deb بسازم که به دوستام که به اینترنت دسترسی ندارن منتقل کنم؟؟
باشه باشه تماس میگیرم

آفلاین سلمان م.

  • ناظر انجمن
  • *
  • ارسال: 4106
  • جنسیت : پسر
  • GNU Operating System - سیستم عامل گنو
پاسخ : چگونه فایل deb بسازیم؟؟؟؟
« پاسخ #3 : 01 تیر 1393، 02:25 ق‌ظ »
خودم اصلا نمیتونم فایل deb بسازم که به دوستام که به اینترنت دسترسی ندارن منتقل کنم؟؟
بله می‌تونی. من فکر کردم منظورتون این هست که چجوری وارد مخازن اوبونتو کنید. در هر صورت فرقی نمی‌کنه باید همون مطالب بالا رو بخونید.

آفلاین جادی

  • عضو کاربران ایرانی اوبونتو
  • *
  • ارسال: 1636
    • در دفاع از آزادی بیان
پاسخ : چگونه فایل deb بسازیم؟؟؟؟
« پاسخ #4 : 07 تیر 1393، 08:49 ق‌ظ »
و نگاهی هم بنداز به دستور convert از مجموعه imagemagick که همه اینکارها رو می کنه (:
آزادی کیبورد حق هر انسان است - جادی

آفلاین Ghost Shadow

  • High Hero Member
  • *
  • ارسال: 1803
  • جنسیت : پسر
  • Linux is Secured By Design
پاسخ : چگونه فایل deb بسازیم؟؟؟؟
« پاسخ #5 : 07 تیر 1393، 09:41 ق‌ظ »
و نگاهی هم بنداز به دستور convert از مجموعه imagemagick که همه اینکارها رو می کنه (:

به شدت تایید میشه :D