def transit_clicked(obj, item=None):
    win = StandardWindow("transit", "Transit")
    win.autodel = True

    bx = Box(win)
    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    win.resize_object_add(bx)
    bx.size_hint_min = 318, 318
    bx.show()

    ic = Image(win, file=os.path.join(img_path, "icon_11.png"),
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))

    bt = Button(win, text="ImageAnimation Effect")
    bt.part_content_set("icon", ic)
    bx.pack_end(bt)
    bt.show()
    ic.show()
    bt.callback_clicked_add(transit_image_animation, ic)

    bt = Button(win, text="Color, Rotation and Translation")
    bx.pack_end(bt)
    bt.show()
    bt.callback_clicked_add(transit_rotation_translation_color)

    bt = Button(win, text="Wipe Effect")
    bx.pack_end(bt)
    bt.show()
    bt.callback_clicked_add(transit_wipe)

    win.show()
Esempio n. 2
0
class Bubble(SmartObject):
    def __init__(self, win):
        SmartObject.__init__(self, win.evas)
        self.name = "bubble"
        #, pos=(0,100)
        bubble_size = (2*106, 2*159)
        self.bubble = Image(win, size=bubble_size, file=os.path.join(img_path, "bulle.png"))
        self.bubble.clip = Rectangle(win.evas, size=bubble_size, color=(255,255,255,200) )
        self.member_add(self.bubble)
        self.member_add(self.bubble.clip)

        self.show()

    def show(self):
        self.bubble.clip.show()
        self.bubble.show()

    def hide(self):
        self.bubble.clip.hide()

    def add(self, content, ratio=1.0, offset_y=None):
        if not offset_y:
            offset_y=(180- 180/ratio)/2
        content.size=(180,180/ratio)
        content.show()
        content.pos=self.pos
        content.clip=self.bubble.clip
        self.content=content
        self.member_add(content)
        content.move_relative(15,15+offset_y)
Esempio n. 3
0
File: ePad.py Progetto: emctoo/ePad
    def fileExists(self, filePath):

        self.confirmPopup = Popup(self.mainWindow,
                                  size_hint_weight=EXPAND_BOTH)

        # Add a table to hold dialog image and text to Popup
        tb = Table(self.confirmPopup, size_hint_weight=EXPAND_BOTH)
        self.confirmPopup.part_content_set("default", tb)
        tb.show()

        # Add dialog-error Image to table
        need_ethumb()
        icon = Icon(self.confirmPopup, thumb='True')
        icon.standard_set('dialog-question')
        # Using gksudo or sudo fails to load Image here
        #   unless options specify using preserving their existing environment.
        #   may also fail to load other icons but does not raise an exception
        #   in that situation.
        # Works fine using eSudo as a gksudo alternative,
        #   other alternatives not tested
        try:
            dialogImage = Image(self.confirmPopup,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_BOTH,
                                file=icon.file_get())
            tb.pack(dialogImage, 0, 0, 1, 1)
            dialogImage.show()
        except RuntimeError:
            # An error message is displayed for this same error
            #   when aboutWin is initialized so no need to redisplay.
            pass
        # Add dialog text to table
        dialogLabel = Label(self.confirmPopup, line_wrap=ELM_WRAP_WORD,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        current_file = os.path.basename(filePath)
        dialogLabel.text = "'%s' already exists. Overwrite?<br><br>" \
                           % (current_file)
        tb.pack(dialogLabel, 1, 0, 1, 1)
        dialogLabel.show()

        # Close without saving button
        no_btt = Button(self.mainWindow)
        no_btt.text = "No"
        no_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
        no_btt.show()
        # Save the file and then close button
        sav_btt = Button(self.mainWindow)
        sav_btt.text = "Yes"
        sav_btt.callback_clicked_add(self.doSelected)
        sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
        sav_btt.show()

        # add buttons to popup
        self.confirmPopup.part_content_set("button1", no_btt)
        self.confirmPopup.part_content_set("button3", sav_btt)
        self.confirmPopup.show()
    def __init__(self):
        StandardWindow.__init__(self, "ex5", "Static Image", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourImage = Image(self)
        ourImage.size_hint_weight = EXPAND_BOTH
        ourImage.file_set("images/logo.png")
        ourImage.tooltip_text_set("A picture!")
        ourImage.show()

        self.resize_object_add(ourImage)
    def __init__(self):
        StandardWindow.__init__(self, "ex5", "Static Image", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourImage = Image(self)
        ourImage.size_hint_weight = EXPAND_BOTH
        ourImage.file_set("images/logo.png")
        ourImage.tooltip_text_set("A picture!")
        ourImage.show()
        
        self.resize_object_add(ourImage)
Esempio n. 6
0
def image_clicked(obj):
    win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        file=os.path.join(img_path, "logo.png"))
    vbox.pack_end(im)
    im.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
        size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    for rot in orients:
        b = Button(win, text=rot[0])
        hbox.pack_end(b)
        b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y))
        b.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    b = Button(win, text="Set remote URL")
    hbox.pack_end(b)
    b.callback_clicked_add(lambda b: im.file_set(remote_url))
    b.show()

    pb = Progressbar(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    hbox.pack_end(pb)
    pb.show()

    im.callback_download_start_add(_cb_im_download_start, pb)
    im.callback_download_done_add(_cb_im_download_done)
    im.callback_download_progress_add(_cb_im_download_progress, pb)
    im.callback_download_error_add(_cb_im_download_error, pb)

    win.show()
Esempio n. 7
0
class CalibratorModule(EmcModule):
   name = 'calibrator'
   label = _('Screen calibrator')
   icon = 'icon/calib'
   info = _('Use this module to calibrate your screen parameters.')
   path = os.path.dirname(__file__)

   def __init__(self):
      config_gui.root_item_add('calibrator', 100, _('Screen calibrator'),
                               icon='icon/calib', callback=self.startup)

   def __shutdown__(self):
      config_gui.root_item_del('calibrator')

   def startup(self):
      self.i = Image(gui.win, aspect_fixed=False,
                     size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
      gui.win.resize_object_add(self.i)
      self.i.show()

      input_events.listener_add(self.name, self.input_event_cb)

      self.current = -1
      self.next_sheet()

   def next_sheet(self):
      self.current = self.current + 1 if self.current < len(sheets) - 1 else 0
      self.i.file = os.path.join(self.path, sheets[self.current])
      print('Loaded: ' + sheets[self.current])

   def prev_sheet(self):
      self.current = self.current - 1 if self.current > 0 else len(sheets) - 1
      self.i.file = os.path.join(self.path, sheets[self.current])

   def close(self):
      self.i.delete()
      input_events.listener_del(self.name)

   def input_event_cb(self, event):
      if event in ('RIGHT', 'DOWN', 'OK'):
         self.next_sheet()
         return input_events.EVENT_BLOCK

      elif event in ('LEFT', 'UP'):
         self.prev_sheet()
         return input_events.EVENT_BLOCK

      elif event in ('BACK', 'EXIT'):
         self.close()
         return input_events.EVENT_BLOCK

      return input_events.EVENT_CONTINUE
Esempio n. 8
0
    def __init__(self, ourParent, ourMsg, ourIcon=None, *args, **kwargs):
        Popup.__init__(self, ourParent, *args, **kwargs)
        self.callback_block_clicked_add(lambda obj: self.delete())

        # Add a table to hold dialog image and text to Popup
        tb = Table(self, size_hint_weight=EXPAND_BOTH)
        self.part_content_set("default", tb)
        tb.show()

        # Add dialog-error Image to table
        need_ethumb()
        icon = Icon(self, thumb='True')
        icon.standard_set(ourIcon)
        # Using gksudo or sudo fails to load Image here
        #   unless options specify using preserving their existing environment.
        #   may also fail to load other icons but does not raise an exception
        #   in that situation.
        # Works fine using eSudo as a gksudo alternative,
        #   other alternatives not tested
        try:
            dialogImage = Image(self,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_BOTH,
                                file=icon.file_get())
            tb.pack(dialogImage, 0, 0, 1, 1)
            dialogImage.show()
        except RuntimeError:
            # An error message is displayed for this same error
            #   when aboutWin is initialized so no need to redisplay.
            pass
        # Add dialog text to table
        dialogLabel = Label(self,
                            line_wrap=ELM_WRAP_WORD,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        dialogLabel.text = ourMsg
        tb.pack(dialogLabel, 1, 0, 1, 1)
        dialogLabel.show()

        # Ok Button
        ok_btt = Button(self)
        ok_btt.text = "Ok"
        ok_btt.callback_clicked_add(lambda obj: self.delete())
        ok_btt.show()

        # add button to popup
        self.part_content_set("button3", ok_btt)
Esempio n. 9
0
File: ePad.py Progetto: emctoo/ePad
def errorPopup(window, errorMsg):
    errorPopup = Popup(window, size_hint_weight=EXPAND_BOTH)
    errorPopup.callback_block_clicked_add(lambda obj: errorPopup.delete())

    # Add a table to hold dialog image and text to Popup
    tb = Table(errorPopup, size_hint_weight=EXPAND_BOTH)
    errorPopup.part_content_set("default", tb)
    tb.show()

    # Add dialog-error Image to table
    need_ethumb()
    icon = Icon(errorPopup, thumb='True')
    icon.standard_set('dialog-warning')
    # Using gksudo or sudo fails to load Image here
    #   unless options specify using preserving their existing environment.
    #   may also fail to load other icons but does not raise an exception
    #   in that situation.
    # Works fine using eSudo as a gksudo alternative,
    #   other alternatives not tested
    try:
        dialogImage = Image(errorPopup,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH,
                            file=icon.file_get())
        tb.pack(dialogImage, 0, 0, 1, 1)
        dialogImage.show()
    except RuntimeError:
        # An error message is displayed for this same error
        #   when aboutWin is initialized so no need to redisplay.
        pass
    # Add dialog text to table
    dialogLabel = Label(errorPopup, line_wrap=ELM_WRAP_WORD,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
    dialogLabel.text = errorMsg
    tb.pack(dialogLabel, 1, 0, 1, 1)
    dialogLabel.show()

    # Ok Button
    ok_btt = Button(errorPopup)
    ok_btt.text = "Ok"
    ok_btt.callback_clicked_add(lambda obj: errorPopup.delete())
    ok_btt.show()

    # add button to popup
    errorPopup.part_content_set("button3", ok_btt)
    errorPopup.show()
Esempio n. 10
0
class EyeBalls(SmartObject): #Transformable

    def __init__(self, win, eyes):
        SmartObject.__init__(self, win.evas)
        self.name = "eyeballs"

        self.eyeballs = Image(
            win, pos=eyeballs_pos, size=eyeballs_size, file=os.path.join(img_path, "retine_sim.png"))


        self.member_add(self.eyeballs)
        #Transformable.__init__(self, self.eyeballs)

        self.show()

    def show(self):
        self.eyeballs.show()

    def hide(self):
        self.eyeballs.hide()
Esempio n. 11
0
def main_loop():
    win = StandardWindow("WLX42 Eyes", "Eyes of the robot", autodel=True)
    win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Rectangle(win.evas, size = screenSize, color=(0,0,100,255), pos=(0,0))
    #bg.clip = Rectangle(win.evas, size = screenSize, color=(0,0,100,255), pos=(0,100) )
    bg.show()

    underlay = Rectangle(win.evas, pos=global_offset, size = screenSize, color=(255,255,255,255))
    underlay.show()

    eyes = Image(win, size = screenSize, pos=global_offset, file=os.path.join(img_path, "oeil-1.png"))
    #overlay.clip = Image(win, size = screenSize, pos=(0,0), file=os.path.join(img_path, "mb.png"))
    #overlay.clip.show()
    eyes.clip = Rectangle(win.evas, size = screenSize, color=(0,0,100,255), pos=(0,0) )
    eyes.clip.show()
    eyes.show()

    mustache = Image(win, size=screenSize, pos=global_offset, file=os.path.join(img_path, "moustaches.png"))
    mustache.clip = Rectangle(win.evas, size = screenSize, color=(0,0,100,255), pos=(0,0) )
    mustache.clip.show()
    mustache.stack_above(eyes)
    mustache.show()

    bubble_pos = (0,100)
    bubble_size = (2*106, 2*159)

    bubble = Image(win, size = bubble_size, pos=bubble_pos, file=os.path.join(img_path, "bulle.png"))

    bubble.clip = Rectangle(win.evas, size = bubble_size, color=(255,255,255,200), pos=bubble_pos )
    bubble.clip.show()
    bubble.stack_above(eyes)
    bubble.show()

    bubble_text_pos=(bubble_pos[0]+10, bubble_pos[1]+10)
    bubble_text = Text(win.evas, text='', color=(255,255,255,255), pos=bubble_text_pos, size=(180,180))
    bubble_text.font_source = font_path
    bubble_text.font = "FontAwesome", 150
    bubble_text.style = EVAS_TEXT_STYLE_SOFT_SHADOW
    bubble_text.shadow_color = (64,64,64,127)
    bubble_text.stack_above(bubble)
    bubble_text.show()

#    bx = Box(win)
#    win.resize_object_add(bx)
#    bx.size_hint_weight = EXPAND_BOTH
#    bx.show()
#    lb.show()

#    lb = Label(win, text="Blah, Blah, Blah")
#    lb2 = Label(win, text="Tut, Tut, Tut!")
#    bb = Bubble(win, text = "Message 1", content = lb,
#        pos = ELM_BUBBLE_POS_TOP_LEFT, size_hint_weight = EXPAND_BOTH,
#        size_hint_align = FILL_BOTH)
#    bb.part_text_set("info", "Corner: top_left")
#    bb.part_content_set("icon", ic)
#    bx.pack_end(bb)
#    bb.show()

    eyeballs = Image(win, size = eyeballs_size, pos=eyeballs_pos, file=os.path.join(img_path, "retine_sim.png"))
    

    blink = Image(win, size = screenSize, pos = global_offset, file=os.path.join(img_path, "oeil-11.png"))
    blink.clip = eyes.clip;

    dead = Image(win, size = screenSize, pos = global_offset, file=os.path.join(img_path, "oeil-10.png"))

    #eyes
    eyeballs.stack_below(eyes)
    eyeballs.show()

    def on_tick(*args, **kargs):
        draw(win, bg, eyeballs, eyes, blink)
        return True

    Animator(on_tick)

    draw(win, bg, eyeballs, eyes, blink)

    win.resize(screenX, screenY)
    win.show()
Esempio n. 12
0
File: ePad.py Progetto: emctoo/ePad
    def __init__(self, parent, canvas):

        self._parent = parent
        self._canvas = canvas
        # Dialog Window Basics
        self.aboutDialog = Window("epad", ELM_WIN_DIALOG_BASIC)
        #
        self.aboutDialog.callback_delete_request_add(self.closeabout)
        #    Set Dialog background
        background = Background(self.aboutDialog, size_hint_weight=EXPAND_BOTH)
        self.aboutDialog.resize_object_add(background)
        background.show()
        #
        mainBox = Box(self.aboutDialog, size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        self.aboutDialog.resize_object_add(mainBox)
        mainBox.show()
        #
        need_ethumb()
        icon = Icon(self.aboutDialog, thumb='True')
        icon.standard_set('accessories-text-editor')

        # Using gksudo or sudo fails to load Image here
        #   unless options specify using preserving their existing environment.
        #   may also fail to load other icons but does not raise an exception
        #   in that situation.
        # Works fine using eSudo as a gksudo alternative,
        #   other alternatives not tested
        try:
            aboutImage = Image(self.aboutDialog, no_scale=True,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH,
                               file=icon.file_get())
            aboutImage.aspect_fixed_set(False)

            mainBox.pack_end(aboutImage)
            aboutImage.show()
        except RuntimeError as msg:
            print("Warning: to run as root please use:\n"
                  "\t gksudo -k or sudo -E \n"
                  "Continuing with minor errors ...")

        labelBox = Box(self.aboutDialog, size_hint_weight=EXPAND_NONE)
        mainBox.pack_end(labelBox)
        labelBox.show()
        #    Entry to hold text
        titleStr = '<br>ePad version <em>{0}</em><br>'.format(__version__)
        aboutStr = ('<br>A simple text editor written in <br>'
                    'python and elementary<br>')
        aboutLbTitle = Label(self.aboutDialog, style='marker')
        aboutLbTitle.text = titleStr
        aboutLbTitle.show()

        labelBox.pack_end(aboutLbTitle)

        sep = Separator(self.aboutDialog, horizontal=True)
        labelBox.pack_end(sep)
        sep.show()

        aboutText = Label(self.aboutDialog)
        aboutText.text = aboutStr

        aboutText.show()
        labelBox.pack_end(aboutText)

        aboutCopyright = Label(self.aboutDialog)
        aboutCopyright.text = '<b>Copyright</b> © <i>2014 Bodhi Linux</i><br>'

        aboutCopyright.show()
        labelBox.pack_end(aboutCopyright)

        # Dialog Buttons
        #    Horizontal Box for Dialog Buttons
        buttonBox = Box(self.aboutDialog, horizontal=True,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH, padding=PADDING)
        buttonBox.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0)
        buttonBox.show()
        labelBox.pack_end(buttonBox)
        #    Credits Button
        creditsBtn = Button(self.aboutDialog, text="Credits ",
                            size_hint_weight=EXPAND_NONE)
        creditsBtn.callback_clicked_add(self.creditsPress)
        creditsBtn.show()
        buttonBox.pack_end(creditsBtn)
        #    Close Button
        okBtn = Button(self.aboutDialog, text=" Close ",
                       size_hint_weight=EXPAND_NONE)
        okBtn.callback_clicked_add(self.closeabout)
        okBtn.show()
        buttonBox.pack_end(okBtn)

        # Ensure the min height
        self.aboutDialog.resize(300, 100)