Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /home/ift/52_procpy/konto1/project/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : //home/ift/52_procpy/konto1/project/schedule.py

import os,sys,re,time,datetime
import matplotlib.pyplot as plt


class Schedule (object):

#******************************************************************************

    def __init__ (self,breite,hoehe):
    

        self.breite = breite
        self.hoehe  = hoehe

        self.gfac   = 0.01
        self.space  = 0.001
        self.total  = 0.0
        self.dates  = {}

#        fig,ax = plt.subplots()
        fig = plt.figure(frameon=False,figsize=(breite,hoehe),dpi=600) #  11.69,8.27
#        plt.subplots_adjust(left=-0.0,right=1.0,bottom=0.0,top=1.0)
        ax = plt.Axes(fig, [0.0,0.0,1.0,1.0])
        ax.set_axis_off()
        fig.add_axes(ax)
#        plt.axis('off')
#        plt.rc('font',size=int(10*self.gfac))

#        plt.axvline(0,color="black",linewidth=0.0) #,linestyle="dashed")
#        plt.axvline(1,color="black",linewidth=0.0)
#        plt.axhline(0,color="black",linewidth=0.0)
#        plt.axhline(1,color="black",linewidth=0.0)

        self.plt = plt

        
#******************************************************************************

    def block (self,shape,a,b,y,h,c,t,ha="center",va="center",ctext="white",tsize="small"):

#        a  = a-1
        a1 = a + self.space
        b1 = b - self.space
#        h  = h - 0.2
    
        einrueckung = 0.5 * self.gfac
    
        a2 = a + einrueckung
        b2 = b - einrueckung
        m  = y + h/2
        y9 = y + h
    
        t = re.sub(r" nnn ","\n",t,99)

        if shape == "arrow":
#            print(t,a,y,b,y9)
            plt.gca().fill([a ,a2,a,b2,b,b2],
                           [y9,m ,y,y,m,y9],linewidth=0,color=c)
        if shape == "block":
            plt.gca().fill([a1,a1,b1,b1],
                           [y9,y ,y ,y9],linewidth=0,color="grey")
    
#        plt.gca().add_patch(plt.Rectangle( (a,y), b-a, h, color=c  ) )
        if ha == "left":
            self.plt.text(a1,y+h/2,t,ha=ha,va="center",size=tsize,color=ctext,weight=700)
        else:
            self.plt.text(a1+(b1-a1)/2,y+h/2,t,ha=ha,va="center",size=tsize,color=ctext,weight=700)


#******************************************************************************

    def milestone (self,a,b,ah,t,ha="left",ctext="black",tsize="medium"):

        bh = self.breite/self.hoehe * ah

        a1 = a + ah/2
        a2 = a - ah/2
        b1 = b + bh/2
        b2 = b - bh/2

        t = re.sub(r" nnn ","\n",t,99)

        self.plt.gca().fill([a,a1,a,a2],
                       [b1,b,b2,b],linewidth=1,color="#ff5533")
    
        self.plt.text(a1,b,t,ha=ha,va="center",size=tsize,color=ctext,weight=700)


#******************************************************************************

    def read_data (self,text):
    
        self.data = text.split("\n")
        self.text = text
        
        self.max_datum = 0
        self.min_datum = 99999999
        
        self.projects  = []
        
        self.pools     = {}

#******************************************************************************

    def project (self,pname):
    
        nproj               = {}
        nproj['steps']      = []
        nproj['milestones'] = []

        for line in self.data:
        
            if not ("-" + pname) in line:
                continue
            m = re.search(r"(\d\d\d\d\d\d\d\d) +(\-?\d+\.\d\d) +(\S+) +(\S+) +(\-?\d+\.\d\d) +(.+?) *$",line)
            if not m:
                continue
            datum  = m.group(1)
            betrag = m.group(2)
            ktoa   = m.group(3)
            ktob   = m.group(4)
            remark = m.group(6)
            if float(betrag) > 0.0 and float(betrag) < 0.02:   #   milestone
                hoehe = 1.0
                m = re.search(r"^(\d\.\d+) (.*)$",remark)
                if m:
                    hoehe  = float(m.group(1))
                    remark = m.group(2)
                remark = re.sub(r"&","\n",remark,99)
                nproj['milestones'].append([datum,remark,hoehe])
                continue

            self.min_datum = min(int(datum),self.min_datum)
            self.max_datum = max(int(datum),self.max_datum)
            
            scolor = "grey"
            pool1  = ""
            for pool in self.pools:
                if pool in ktob:
                    pool1 = pool
                    scolor = self.pools[pool]

            if 'title' in nproj:
                a_d    = int( datetime.datetime.strptime("%8u"%float(datum0),"%Y%m%d").strftime("%s") )
                b_d    = int( datetime.datetime.strptime("%8u"%float(datum ),"%Y%m%d").strftime("%s") )
                leistung  = ( float(betrag0) / 1.0 ) / ( (b_d - a_d) / 86400 / 30 )
#                print(b_d,a_d,leistung)

                leistung = 1.0     #  <--  CHANGE

                self.dates[datum0] = 1
                self.dates[datum]  = 1
                nproj['maxheight'] = max(nproj['maxheight'],leistung)
                pstep  = [datum0,datum,scolor,re.sub(r"xx","\\n"+("%2.1f"%float(betrag0)),remark0),leistung]
                pstep  = [datum0,datum,scolor,re.sub(r"xx","",remark0),leistung]    #   <-- CHANGE
                nproj['steps'].append(pstep)
                nproj['total'] = nproj['total'] + float(betrag0)
                self.total     = self.total + float(betrag0)
            else:
                nproj['maxheight'] = 0.0
                nproj['total']     = 0.0
                nproj['pool']      = pool1
                
            datum0         = datum
            remark0        = remark
            betrag0        = betrag
            nproj['title'] = remark
            
            
        self.projects.append(nproj)

#******************************************************************************

    def project1 (self,pname,description):
    
        nproj               = {}
        nproj['steps']      = []
        nproj['milestones'] = []

        steps = {}


        for line in self.data:
        
            if not ("-" + pname) in line:
                continue
            m = re.search(r"(\d\d\d\d\d\d\d\d) +(\-?\d+\.\d\d) +(\S+) +(\S+) +(\-?\d+\.\d\d) +(.+?) *$",line)

            if m:
                
                datum  = m.group(1)
                betrag = m.group(2)
                ktoa   = m.group(3)
                ktob   = m.group(4)
                remark = m.group(6)
             
                m = re.search(r"\-(\d+)$",ktoa)
                if not m:
                    continue
                
                step = m.group(1)
                if not step in steps:
                    steps[step] = [datum,datum,0.00,remark]
                else:
                    steps[step][1] = datum
                    
                self.min_datum = min(int(datum),self.min_datum)
                self.max_datum = max(int(datum),self.max_datum)

            else:

                m = re.search(r"^(\S+)\-(\d+) +(\-?\d\.\d\d)")
                if not m:
                    continue
                step   = m.group(2) 
                betrag = m.group(3)
                steps[step][2] = float(betrag)
                steps[step][3] = re.sub(r"xx","\\n"+("%2.1f"%float(betrag)),steps[step][3])
                

        for step in steps:
        
            datum0 = step[0]
            datum1 = step[1]
            betrag = step[2]
            remark = step[3]
            
            if datum0 == datum1 and betrag < 0.0001:   #  Milestone
                hoehe = 1.0
                m = re.search(r"^(\d\.\d+) (.*)$",remark)
                if m:
                    hoehe  = float(m.group(1))
                    remark = m.group(2)
                remark = re.sub(r"&","\n",remark,99)
                nproj['milestones'].append([datum0,remark,hoehe])
                continue

            else:
            
                nproj['steps'].append([datum0,datum1,betrag,remark])
            


#   @@@@        


            if float(betrag) > 0.0 and float(betrag) < 0.02:   #   milestone
                hoehe = 1.0
                m = re.search(r"^(\d\.\d+) (.*)$",remark)
                if m:
                    hoehe  = float(m.group(1))
                    remark = m.group(2)
                remark = re.sub(r"&","\n",remark,99)
                nproj['milestones'].append([datum,remark,hoehe])
                continue

            
            scolor = "grey"
            pool1  = ""
            for pool in self.pools:
                if pool in ktob:
                    pool1 = pool
                    scolor = self.pools[pool]






            if 'title' in nproj:
                a_d    = int( datetime.datetime.strptime("%8u"%float(datum0),"%Y%m%d").strftime("%s") )
                b_d    = int( datetime.datetime.strptime("%8u"%float(datum ),"%Y%m%d").strftime("%s") )
                leistung  = ( float(betrag0) / 1.0 ) / ( (b_d - a_d) / 86400 / 30 )
#                print(b_d,a_d,leistung)
                self.dates[datum0] = 1
                self.dates[datum]  = 1
                nproj['maxheight'] = max(nproj['maxheight'],leistung)
                pstep  = [datum0,datum,scolor,re.sub(r"xx","\\n"+("%2.1f"%float(betrag0)),remark0),leistung]
                nproj['steps'].append(pstep)
                nproj['total'] = nproj['total'] + float(betrag0)
                self.total     = self.total + float(betrag0)
            else:
                nproj['maxheight'] = 0.0
                nproj['total']     =  0.0
                nproj['pool']      = pool1
                
            datum0         = datum
            remark0        = remark
            betrag0        = betrag
            nproj['title'] = remark
            
            
        self.projects.append(nproj)

#******************************************************************************
    
    def make_schedule (self,text,filename):

        breite   =  self.gfac
        linediff =  breite * 1.3

        self.min_datum = 20231001
        self.max_datum = 20241231
        
#        print(self.projects)
        

        plt = self.plt

#        plt.gca().fill([0.0,0.01,0.01,0.0],
#                       [0.0,0.0,0.01,0.01],linewidth=0,color="#888888")
#        plt.gca().fill([1.0,0.99,0.99,1.0],
#                       [0.0,0.0,0.01,0.01],linewidth=0,color="#888888")
#        plt.gca().fill([0.0,0.01,0.01,0.0],
#                       [1.0,1.0,0.99,0.99],linewidth=0,color="#888888")
#        plt.gca().fill([1.0,0.99,0.99,1.0],
#                       [1.0,1.0,0.99,0.99],linewidth=0,color="#888888")


        for quartal in self.projects:
        

            min_d = int( datetime.datetime.strptime("%8u"%self.min_datum,"%Y%m%d").strftime("%s") )
            max_d = int( datetime.datetime.strptime("%8u"%self.max_datum,"%Y%m%d").strftime("%s") )

            for qu in [
                         ["20231015","20231230","23/IV"],
                         ["20240101","20240330","24/I"],
                         ["20240401","20240630","24/II"],
                         ["20240701","20240930","24/III"],
                         ["20241001","20241230","24/IV"] ]:
                a_d = int( datetime.datetime.strptime("%8u"%float(qu[0]),"%Y%m%d").strftime("%s") )
                b_d = int( datetime.datetime.strptime("%8u"%float(qu[1]),"%Y%m%d").strftime("%s") )
                a   = "%3.3f" % (0.14 + 0.86 * (a_d - min_d)/(max_d - min_d))
                b   = "%3.3f" % (0.14 + 0.86 * (b_d - min_d)/(max_d - min_d))
                self.block("block",float(a),float(b),0.95,0.05,"#999999",qu[2],tsize="large")
                
            break
            
        line = 0.92

        zaehler = 0
        while zaehler < 3:

            zaehler = zaehler + 1

            totalheight = 0.0
            nr_of_proj  = 0
            for project in self.projects:
                totalheight = totalheight + project['maxheight']
                nr_of_proj = nr_of_proj + 1

            for project in self.projects:
                project['maxheight'] = max (project['maxheight'],0.9*totalheight/nr_of_proj)

        for project in self.projects:
            project['rel'] = project['maxheight'] / totalheight

        for project in self.projects:

            rel_height = project['maxheight'] / totalheight * 0.92
            linediff   = rel_height
            breite     = rel_height * 0.6

#            print(rel_height,line,linediff)
            min_d = int( datetime.datetime.strptime("%8u"%self.min_datum,"%Y%m%d").strftime("%s") )
            max_d = int( datetime.datetime.strptime("%8u"%self.max_datum,"%Y%m%d").strftime("%s") )

            line = line - linediff
            project['title'] = re.sub(r" nnn ","\n",project['title'],99)
            self.block("block",0.0,0.1,line,breite,"#777777", project['title']
#                 + "\n" + ("%2.1f"%project['total'])  #  <--  CHANGE
                 , "left",va="bottom")
#            print(project['title'],1,7,line,breite,"<---")
            
            for pstep in project['steps']:
                a_d = int( datetime.datetime.strptime("%8u"%float(pstep[0]),"%Y%m%d").strftime("%s") )
                b_d = int( datetime.datetime.strptime("%8u"%float(pstep[1]),"%Y%m%d").strftime("%s") )
                a   = "%3.3f" % (0.14 + 0.86 * (a_d - min_d)/(max_d - min_d))
                b   = "%3.3f" % (0.14 + 0.86 * (b_d - min_d)/(max_d - min_d))
#                print(project['title'])
#                print(a,b,pstep,min_d,max_d)

                
                breite = pstep[4] / totalheight * 0.92
                breite = breite * 0.6
#                print(a,b,line,breite,"..")
                self.block("arrow",float(a),float(b),line,breite,pstep[2],pstep[3],va="bottom")
                
            for milestone in project['milestones']:
                a_d = int( datetime.datetime.strptime("%8u"%float(milestone[0]),"%Y%m%d").strftime("%s") )
                a   = "%3.2f" % (0.14 + 0.86 * (a_d - min_d)/(max_d - min_d))
                breite = project['maxheight'] / totalheight * 0.92
                breite = breite * 0.6
                self.milestone(float(a),line+breite*milestone[2],0.02,milestone[1])
            
#        plt.imsave("111.pdf",orientation="landscape")
        plt.savefig(filename+".pdf",orientation="landscape",bbox_inches='tight',pad_inches=0.0)
        plt.savefig(filename+".svg",orientation="landscape",bbox_inches='tight',pad_inches=0.0)
        return()

                
        self.pleistung = {}   #  Leistungen aufaddieren
        
        dates = list(self.dates.keys())
        dates.sort()
        for pool in self.pools:
#            print("Pool: " + pool)
            if not pool in self.pleistung:
                self.pleistung[pool] = {}
            for project in self.projects:
                if pool == project['pool']:
                    for date in dates:
#                        print(project['title'],pool,date)
                        for pstep in project['steps']:
#                            print(pstep)
                            if int(pstep[0]) <= int(date) and int(date) < int(pstep[1]):
                                if not date in self.pleistung[pool]:
                                    dates1 = list(self.pleistung[pool].keys())
                                    dates1.sort()
                                    self.pleistung[pool][date] = 0.0
                                    for date1 in dates1:
                                        if int(date1) <= int(date):
                                            continue
                                        self.pleistung[pool][date] = self.pleistung[pool][date1]
                                        continue
                                self.pleistung[pool][date] = self.pleistung[pool][date] + pstep[4]
#                                print("..." + str(self.pleistung[pool][date]))
                                continue
            dates = list(self.pleistung[pool].keys())
            dates.sort()
            o3 = []
            b0 = 0.0
            for date in dates:
                if self.pleistung[pool][date] == b0:
                    continue
                o3.append( date[2:]+":"+("%3.2f" % self.pleistung[pool][date]) )
                b0 = self.pleistung[pool][date]
            print( (pool+"          ")[0:9] + " ".join(o3) )
                                
#os.system("cp "+filename+".pdf test.pdf")
#    
#




bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net