Beispiel #1
0
 def render_plot( self, svg, paint ):
     g = group.Group()
     
     g.matrix ( 1, 0, 0, -1, 0, 0 )
     g.translate ( 0, -self.yAxis.length)
     
     plot_group = group.Group()
     
     len_data = len( self.data )-1
     x_coords = range( 0, len_data * self.xAxis.length, self.xAxis.length / len_data )
     plot = Plot( zip( x_coords, self.yAxis.transform( self.data ) ), Point.Type.CIRCLE )
 
     self.xAxis.setTicks( range(0, len( self.data )) )
     self.yAxis.setTicks( range(0, 11 ) )
 
     self.xAxis.render( plot_group, paint )
     self.yAxis.render( plot_group, paint )
     
     self.grid.render( plot_group, paint )
     
     plot.render( plot_group, paint )
     
     g.append( plot_group )
     
     svg.append( g )
Beispiel #2
0
    def render( self, svg ):
      
        plot_line = group.Group()
    
        if self.shadow and self.paint.stroke_width != None:
            shadow_paint = Paint()
            shadow_paint.stroke_width = self.paint.stroke_width * 2
            shadow_paint.stroke = SHADOW_COLOR
            p = path.Path ()

            utils.copy_object ( shadow_paint, p )
            p.moveto ( [ (c[0],c[1]-(shadow_paint.stroke_width-1)) for c in self.coords ] )
            plot_line.append( p )
        
        if self.paint.fill != None and self.paint.fill.upper != "NONE":
            paint = Paint( fill = self.paint.fill )
            p = path.Path ()    
            p.moveto ( self.coords )
            p.vertical( 0 )
            p.horizontal( 0 )
            p.close()
            utils.copy_object( paint, p )
            plot_line.append( p )
            
        paint = Paint()
        utils.copy_object( self.paint, paint )
        
        paint.fill = "None"
        
        p = path.Path() 
        
        if self.startMarker != None:
            p.marker_start = self.startMarker.getURI()
        
        if self.midMarker != None:
            p.marker_mid = self.midMarker.getURI()
        
        if self.endMarker != None:
            p.marker_end = self.endMarker.getURI()

        p.moveto( self.coords )
    
        utils.copy_object( paint, p )
        plot_line.append( p )
        
        svg.append( plot_line )
        
        plot_points = group.Group()
        utils.copy_object ( paint, plot_points )
        plot_points.fill = plot_points.stroke
Beispiel #3
0
 def remove_odd_group(self,pairs_list):
         print("tested!")
         partners = gr.Group()
         partners.add_students([self.students[0], self.students[1], self.students[2]])
         for i in range(3):
             self.students.pop(0)
         pairs_list.append(partners)
Beispiel #4
0
    def __init__(self, lie_type, rank):
        self.lie_type = lie_type
        self.rank = rank
        self.label = self.lie_type + str(self.rank)

        self.rootsystem = rs.RootSystem(self)
        self.dim = self.rootsystem.nr_roots + self.rank

        self.weyl = wg.Weyl(self)
        self.parabolics = pa.Parabolics(self)
        self.constants = cs.Constants(self)
        nr = self.rootsystem.nr_roots
        self.var = vr.Variables(2 * nr, 2 * nr, 2 * self.rank)
        self.group = gr.Group(self)
        self.lie = la.LieAlgebra(self)
        self.ad_action = ad.AdAction(self)

        self.bruhat = br.Bruhat(self)
        self.deodhar = dr.Deodhar(self)
        if self.label == "a2":
            self.curtis = CurtisA2(self)
        if self.label == "b2":
            self.curtis = CurtisB2(self)
        if self.label == "g2":
            self.curtis = CurtisG2(self)
Beispiel #5
0
 def render( self, svg, paint ):
     g = group.Group()    
     utils.copy_object ( paint, g )
         
     width = self.xAxis.length + self.xAxis.bias
     height = self.yAxis.length + self.yAxis.bias
     
     if self.xGrid and self.xAxis.tick_positions != None:
         for pos in self.xAxis.tick_positions:
             h = Line ()
             h.x1 = pos
             h.y1 = 0
             h.x2 = pos
             h.y2 = height
             g.append( h )
         
     if self.yGrid and self.yAxis.tick_positions != None:
         for pos in self.yAxis.tick_positions:
             v = Line ()
             v.x1 = 0
             v.y1 = pos
             v.x2 = width
             v.y2 = pos
             g.append( v )
     
     svg.append( g )
Beispiel #6
0
 def render( self, svg ):
     g = group.Group()
     g.matrix ( 1, 0, 0, -1, 0, 0 )
     
     g.fill = g.stroke
     
     i = 0
     
     if self.axis.tick_positions != None:
         positions = self.axis.tick_positions
     else:
         positions = [0]
     
     for p in positions:
         label = Text( str(self.labels[i]) )
         label.text_anchor = 'middle'
         label.font_family= "Arial"
         label.stroke = "gray"
         label.fill = "gray"
         label.stroke_width = "0.1"
         label.font_size = "70%"
             
         if self.axis.orientation == Axis.Orientation.HORIZONTAL:
             label.translate ( p, 20 )
             label.rotate ( 330 )
             
         elif self.axis.orientation == Axis.Orientation.VERTICAL:
             label.translate ( -25, -p )
                 
         
         g.append( label )
             
         i = i + 1
             
     svg.append( g )
Beispiel #7
0
 def render( self, svg ):
   
     bar_group = group.Group()
     
     if self.shadow and self.length > 0:
         shadow_paint = Paint()
         shadow_paint.fill = "#BBB"
         shadow_paint.fill_opacity = 0.6
         
         shadow = rect.Rect()    
         shadow.x = self.x
         shadow.y = self.y - 3
         shadow.width = self.length + 3
         shadow.height = self.width
         
         utils.copy_object( shadow_paint, shadow )
         
         bar_group.append( shadow )
       
     r = rect.Rect()    
     r.x = self.x
     r.y = self.y
     r.width = self.length
     r.height = self.width
     
     utils.copy_object( self.paint, r )
     bar_group.append( r )
     
     svg.append( bar_group )
Beispiel #8
0
def update_group(group_name: str, dataframe: list):
    for group in dataframe:
        if group.name == group_name:
            return group
    a = g.Group(group_name)
    dataframe.append(a)
    return a
Beispiel #9
0
 def render_title( self, svg, paint ):
 
     if self.title != None or self.subtitle != None:
         title_layout = self.layoutMgr.getLayout( 'title' )        
         mid_point = ( title_layout[2] / 2, title_layout[3] / 3 )
         
         text_group = group.Group()
         text_group.translate( title_layout[0], title_layout[1] )
         svg.append( text_group )
 
     if self.title != None:
         
         title = Text( self.title )
         title.text_anchor = 'middle'
         title.font_family= "Arial"
         title.stroke = "black"
         title.stroke_width = "0.5"
         title.translate ( mid_point[0], mid_point[1] )
         
         text_group.append( title )
         
     if self.subtitle != None:
         subtitle = Text( self.subtitle )
         subtitle.font_size = "80%"
         subtitle.font_family= "Arial"
         subtitle.stroke = "black"
         subtitle.stroke_width = "0.5"
         subtitle.translate ( mid_point[0], mid_point[1] + 18 )
         subtitle.text_anchor = 'middle'
         
         text_group.append( subtitle )
Beispiel #10
0
 def combine_hometowns(self,pairs_list):
     
     for student1 in self.students:
         partner = gr.Group()
         partner.add_student(student1)
         copy = gr.Group()
         copy.add_student(student1)
         index = self.students.index(student1)
         for student2 in self.students[index+1:]:
             if student1.hometown == student2.hometown:
                 partner.add_student(student2)
                 if student1 in self.students:
                     self.students.remove(student1)
                 if student2 in self.students:
                     self.students.remove(student2)
         if partner != copy:
             pairs_list.append(partner)
Beispiel #11
0
 def __init__(self, world):
     scene.Scene.__init__(self, world)
     self.sprites = group.Group()
     self.background = common.load("title_background.jpg", False)
     self.title = title_sprite.TitleSprite()
     self.sprites.add(self.title)
     self.draw_background()
     self.counter = 0
Beispiel #12
0
 def clear(self):
     """Clear the list."""
     self.items = []
     self.group = group.Group()
     self.group.connect(CHANGE, self._change, None)
     self.table.clear()
     self.set_vertical_scroll(0)
     self.blur(self.myfocus)
Beispiel #13
0
 def getRootGroup(self):
     """Get the root group for the show
     @rtype: opencue.wrappers.group.Group
     @return: Group wrapper of the root group
     """
     response = self.stub.GetRootGroup(
         show_pb2.ShowGetRootGroupRequest(show=self.data),
         timeout=Cuebot.Timeout)
     return group.Group(response.group)
    def test_empty_init(self):
        "Test the default Group creation"

        # 1. Create default Group object
        myobj = group.Group()

        # 2. Make sure it has the default values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(myobj.text, None)
        self.assertEqual(len(myobj.answers), 0)
    def test_text_init(self):
        "Test the Group object creation from text"

        # 1. Create Group object from text
        myobj = group.Group(text=EXAMPLE_TEXT)

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 14)
        self.assertEqual(len(myobj.answers), 6)
Beispiel #16
0
 def getGroups(self):
     """Get the groups for this show
     @rtype: list<Group>
     @return: list of group wrappers for this show
     """
     response = self.stub.GetGroups(
         show_pb2.ShowGetGroupsRequest(show=self.data),
         timeout=Cuebot.Timeout)
     groupSeq = response.groups
     return [group.Group(grp) for grp in groupSeq.groups]
Beispiel #17
0
 def clear(self):
     """Clear the list.
     
     <pre>List.clear()</pre>
     """
     self.items = []
     self.group = group.Group()
     self.group.connect(CHANGE, self._change, None)
     self.table.clear()
     self.set_vertical_scroll(0)
     if self.myfocus and self.myfocus(): self.blur(self.myfocus())
Beispiel #18
0
 def partner_students(self,pairs_list):
     while self.students:
         partners = gr.Group()
         if len(self.students) == 3:
             partners.add_students([self.students[0], self.students[1], self.students[2]])
             for i in range(3):
                 self.students.pop(0)
         else:
             partners.add_student(self.students.pop(0))
             partners.add_student(self.students.pop(0))
         pairs_list.append(partners)
Beispiel #19
0
    def __init__(self, text=None, part2=False):

        # 1. Set the initial values
        self.part2 = part2
        self.text = text
        self.groups = []

        # 2. Process text (if any)
        if text is not None and len(text) > 0:
            for line in text:
                self.groups.append(group.Group(text=line, part2=part2))
    def test_example2(self):
        "Test part two example of Group object"

        # 1. Loop for all the examples
        for example in EXAMPLES:

            # 2. Create Group object from text
            myobj = group.Group(text=example['text'], part2=True)

            # 2. Check the number of yes aanswers
            self.assertEqual(len(myobj.answers), example['num2'])
Beispiel #21
0
    def setUp(self):
        """
    This is run before each and every test_* function
    """
        self.group = g.Group(0)

        # Add accounts
        self.group.add_account(a.Account("nicolas"))
        self.group.add_account(a.Account("max"))
        self.group.add_account(a.Account("sandrina"))
        self.group.add_account(a.Account("annika"))
Beispiel #22
0
async def on_ready():
    for file in os.listdir():
        if '_boys' in file:
            group_name = file[:-4]
            current_group = group.Group(group_name)
            group_list.append(current_group)
            f = open(file, 'r')
            for line in f.read().splitlines():
                current_group.add_user(line)

            f.close()

    print('Bot is running.')
Beispiel #23
0
    def _grouppacket(self, host, port, packet):
        # Gather Data
        group_id = packet.payload.group
        group_id_tuple = tuple(group_id)  # Hashable type
        group_label = packet.payload.label
        updated_at = packet.payload.updated_at

        if group_id_tuple not in self._groups:
            # Make a new Group
            new_group = group.Group(group_id, self)

            # Store it
            self._groups[group_id_tuple] = new_group
Beispiel #24
0
    def __init__(self, world, level=1):
        pygame.mixer.music.stop()
        scene.Scene.__init__(self, world)
        self.sprites = group.Group()
        self.messages = messages.Messages(self.sprites)
        self.map = map.Map(self, self.sprites, self.messages, world.audio,
                           level)
        self._draw_background_and_map()
        self.change_state(PlayingGameState(self))
        self.level = level

        #self._create_a_pipe()
        self._create_mouse_pointer()
        self.sprites.sort_by_z()
 def __init__(self, world):
     pygame.mixer.init()
     pygame.mixer.music.load('data/presents/music.ogg')
     #music = pygame.mixer.Sound('presents/music.ogg')
     #music.play()
     pygame.mixer.music.play()
     scene.Scene.__init__(self, world)
     self.sprites = group.Group()
     self.background = common.load("presents/background.png", False)
     self.gcoop = GcoopLogo()
     self.presents = PresentsText()
     self.sprites.add(self.gcoop)
     self.draw_background()
     self.counter = 0
Beispiel #26
0
    def __init__(self, width, height, **params):
        params.setdefault('cls', 'list')
        self.table = table.Table(width=width)
        ScrollArea.__init__(self, self.table, width, height,hscrollbar=False ,**params)
        
        self.items = []
        
        g = group.Group()
        self.group = g
        g.connect(CHANGE,self._change,None)
        self.value = self.group.value = None
	
	self.add = self._add
	self.remove = self._remove
Beispiel #27
0
    def _locationpacket(self, host, port, packet):
        # Gather Data
        location_id = packet.payload.location
        location_id_tuple = tuple(location_id)  # Hashable type
        location_label = packet.payload.label
        updated_at = packet.payload.updated_at

        if location_id_tuple not in self._locations:
            # Make a new Group for the location
            new_location = group.Group(location_id, self, self.by_location_id,
                                       device.Device._get_location_data)

            # Store it
            self._locations[location_id_tuple] = new_location
Beispiel #28
0
    def addmenus(self):
        menu = Menu(self)

        self.debug = BooleanVar()
        self.debug.set(False)
        sh = shelve.open("data.db")
        try:
            noprinter = sh['noprinter']
        except:
            noprinter = False
        sh.close()
        self.debug.set(noprinter)

        repmenu = Menu(menu, tearoff=0)
        repmenu.add_command(label="Day Report", command=self.dayreport)
        repmenu.add_command(label="Last Month Report",
                            command=self.monthreport)
        repmenu.add_command(label="Print day bills Detailed (yesterday)",
                            command=self.print_day_bills)
        repmenu.add_command(label="Print day bills (yesterday)",
                            command=self.print_day_bills_summery)
        menu.add_cascade(label="Report", menu=repmenu)

        viewmenu = Menu(menu, tearoff=0)
        viewmenu.add_command(label="bills",
                             command=lambda: showbills.ShowFiles())
        viewmenu.add_command(label="print stockists list",
                             command=self.liststockists)
        viewmenu.add_command(label="review bills", command=self.reviewbills)
        viewmenu.add_command(label="enter credit note",
                             command=lambda: creditnote.CreditNote())
        viewmenu.add_command(label="group drugs",
                             command=lambda: group.Group())
        menu.add_cascade(label="View", menu=viewmenu)

        adminmenu = Menu(menu, tearoff=0)
        adminmenu.add_command(label="Pay Stockists", command=self.purchasepay)
        adminmenu.add_command(label="Passwords",
                              command=lambda: password.Password())
        adminmenu.add_command(label="Edit Stock", command=self.editstock)
        adminmenu.add_checkbutton(label="Debug",
                                  command=self.noprinter,
                                  variable=self.debug)
        adminmenu.add_command(label="Set Printers", command=self.setprinters)
        adminmenu.add_command(label="Set Db params", command=self.dbparams)
        menu.add_cascade(label="Admin", menu=adminmenu)

        self.config(menu=menu)
Beispiel #29
0
    def start(self, bot, update):
        group_id = update.message.chat_id

        found = False

        try:
            self.billingdata.groups[group_id]
            found = True
        except KeyError:
            bot.sendMessage(chat_id=update.message.chat_id,
                            text="Added new group")

        self.billingdata.groups[group_id] = g.Group(group_id)

        if found:
            bot.sendMessage(chat_id=update.message.chat_id,
                            text="Recreated group")
Beispiel #30
0
async def on_message(msg):
    msg_list = msg.content.split(' ')
    channel = msg.channel

    if msg.content == 'ping':
        await channel.send('pong')

    if contains_group(msg.content):
        await message_group(msg.content, channel)

    if msg_list[0] == 'new_group':
        if msg_list[1] != None and '_boys' in msg_list[
                1] and not contains_group(msg_list[1]):
            group_name = msg_list[1]
            group_list.append(group.Group(group_name))
            file = open(group_name + '.txt', 'w+')
            file.close()
            await channel.send('New group ' + group_name + ' added.')
        else:
            await channel.send('Must provide valid group name.')

    if msg_list[0] == 'add_user':
        addgroup = None
        if ('to' in msg_list):
            addgroup = get_group(msg_list[msg_list.index('to') + 1])

        if addgroup != None:
            i = 1
            while msg_list[i] != 'to':
                username = msg_list[i].lower()
                if is_valid_username(username):
                    if username not in addgroup.users:
                        addgroup.add_user(username)
                        file = open(addgroup.name + '.txt', 'a')
                        file.write(username + '\n')
                        file.close()
                        await channel.send(addgroup.name + ' updated.')
                    else:
                        await channel.send(username +
                                           ' is already in that group.')
                else:
                    await channel.send(username + ' is an invalid username.')
                i += 1
        else:
            await channel.send('Not a valid group name')