コード例 #1
0
ファイル: egitu.py プロジェクト: simotek/egitu
def main():

    # parse command line arguments
    parser = argparse.ArgumentParser(description='Efl GIT GUI')
    parser.add_argument('--repo', default=None)
    # parser.add_argument('integers', metavar='N', type=int, nargs='+',
                   # help='an integer for the accumulator')
    # parser.add_argument('--sum', dest='accumulate', action='store_const',
                   # const=sum, default=max,
                   # help='sum the integers (default: find the max)')
    args = parser.parse_args()

    # load config and create necessary folders
    options.load()
    if not os.path.exists(config_path):
        os.makedirs(config_path)

    # create the main window
    elm.init()
    win = EgituWin()

    # try to load a repo, from command-line or cwd (else show the RepoSelector)
    RepoSelector(win, args.repo or os.getcwd())

    # enter the mainloop
    elm.run()

    # mainloop done, shutdown
    elm.shutdown()
    options.save()

    return 0
コード例 #2
0
def main():
    options.load()
    elm.need_ethumb()
    elm.theme_extension_add(THEME_FILE)

    global app
    app = EluminanceApp()
    elm.run()
    options.save()
コード例 #3
0
ファイル: app.py プロジェクト: zenhack/prototype
def run(model, framespec=None, stylesheet=None):
    def default_filename(obj, ext):
        return type(obj).__name__.lower() + '.' + ext

    elm.init()
    my_frame = frame.from_file(framespec or default_filename(model, 'xml'))
    css = CssParser(stylesheet or default_filename(model, 'css'))
    css.attach(my_frame)
    w = my_frame.widget(model)
    elm.run()
    elm.shutdown()
コード例 #4
0
def main():

    # make the application quit when the last window is closed
    elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    # Create the main app window
    win = elm.StandardWindow("main",
                             "My first window",
                             autodel=True,
                             size=(300, 200))

    # Create a simple label
    label = elm.Label(win,
                      text="Hello World Python !",
                      size_hint_expand=EXPAND_BOTH,
                      size_hint_fill=FILL_BOTH)
    win.resize_object_add(label)
    label.show()

    # Show the window and start the efl main loop
    win.show()
    elm.run()
コード例 #5
0
ファイル: main.py プロジェクト: olbabrn/edone
def main():

    # load config and create necessary folders and files
    options.load()
    if not os.path.exists(config_path):
        os.makedirs(config_path)
    if not os.path.exists(options.txt_file):
        with open(options.txt_file, 'a') as f:
            print('(A) Welcome to Etodo', file=f)

    # create the main window and load the todo file
    elm.init()
    win = EdoneWin()
    win.reload()

    # enter the mainloop
    elm.run()

    # mainloop done, shutdown
    elm.shutdown()
    options.save()

    return 0
コード例 #6
0
ファイル: egitu.py プロジェクト: DaveMDS/egitu
def main():

    # load config and create necessary folders
    options.load()
    if not os.path.exists(config_path):
        os.makedirs(config_path)

    # init elm
    elm.init()
    theme_extension_add(theme_file_get())

    # Egitu
    app = EgituApp(sys.argv[1:])
    app_instance_set(app) # Ugly :/

    # enter the mainloop
    elm.run()

    # mainloop done, shutdown
    elm.shutdown()
    options.save()

    return 0
コード例 #7
0
ファイル: edeb.py プロジェクト: JeffHoogland/edeb
            print("Initial check passed.\n")
            self.chk = checks.Checks(path, self.win)
            self.chk.check_file(self.fs, self.win, self.deb)
        self.n.delete()
        self.et.delete()

    def inst_check(self, bt, bt2):
        path = self.fs.selected_get()
        if path == HOME:
            checks.generic_error_popup(self.win, "<b>No File Selected</><br><br>Please select an appropriate file candidate for installation.")
        else:
            self.chk.check_file_install(bt, bt2, self.win, self.fs)

    def bt_init_check(self, path):
        try:
            self.chk.check_file(self.fs, self.win, self.deb)
        except:
            checks.generic_error_popup(self.win, "<b>No File Selected</><br><br>Please select an appropriate file candidate for installation.")


#----- Main -{{{-
if __name__ == "__main__":
    elm.init()

    eDeb(clargs)

    elm.run()
    elm.shutdown()
# }}}
# vim:foldmethod=marker
コード例 #8
0
            password = args[0]
            cmd.send(str(password) + "\n")

    def command_done(self, cmd, event, *args, **kwargs):
        log.info("Command done.")

        if self.end_cb:
            try:
                self.end_cb(event.exit_code, self.win, *self.args,
                            **self.kwargs)
            except Exception:
                log.exception()
        self.close()

if __name__ == "__main__":
    import sys

    new_arg = []
    for i in sys.argv[1:]:
        if ' ' in i:
            i = '"' + i + '"'
        new_arg.append(i)
    cmd = " ".join(new_arg)

    elementary.init()

    start = eSudo(cmd)

    elementary.run()
    elementary.shutdown()
コード例 #9
0
    dt.field_visible_set(ELM_DATETIME_MONTH, False)
    dt.field_visible_set(ELM_DATETIME_DATE, False)
    bx.pack_end(dt)
    dt.show()

    dt = Datetime(bx, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)

    # get the current local time
    time1 = datetime.now()
    # set the max year as 2030 and the remaining fields are equal to current time values
    time1.replace(year = 130)
    dt.value_max = time1
    # set the min time limit as "1980 January 10th 02:30 PM"
    time1.replace(year = 80, month = 4, day = 10, hour = 14, minute = 30)
    dt.value_min = time1
    # minutes can be input only in between 15 and 45
    dt.field_limit_set(ELM_DATETIME_MINUTE, 15, 45)
    dt.callback_changed_add(changed_cb)
    bx.pack_end(dt)
    dt.show()

    win.show()

if __name__ == "__main__":
    elementary.init()

    datetime_clicked(None)

    elementary.run()
    elementary.shutdown()
コード例 #10
0
    
    def eventsCb(self, obj, src, event_type, event):
        #print(obj)
        #print(src)
        #print(event.key.lower())
        #print(event_type)
        #print("")

        if not event_type == EVAS_CALLBACK_KEY_UP:
            return False

        if event.keyname == "Up":
            self.lifeChange("mine", "up")
        elif event.keyname == "Down":
            self.lifeChange("mine", "down")
        elif event.keyname == "Right":
            self.lifeChange("thiers", "up")
        elif event.keyname == "Left":
            self.lifeChange("theirs", "down")
            

        event.event_flags = event.event_flags | EVAS_EVENT_FLAG_ON_HOLD
        return True

if __name__ == "__main__":
    elm.init()
    GUI = MainWindow()
    #GUI.show()
    elm.run()
    elm.shutdown()
コード例 #11
0
    def run(self):
        self.win.show()

        self.timer = Timer(1.0, self.update)
        elm.run()
        self.quit()
コード例 #12
0
    def run(self):
        self.win.show()

        self.timer = Timer(1.0, self.update)
        elm.run()
        self.quit()
コード例 #13
0
def main():
    elm.init()
    win = EspionageWin()
    elm.run()
    elm.shutdown()
    return 0
コード例 #14
0
ファイル: main.py プロジェクト: DaveMDS/epymc
def start_epymc(standalone=False):

   # parse command line arguments
   parser = argparse.ArgumentParser(description='Emotion Media Center v%s' % emc_v)
   parser.add_argument('-a', '--activity',
                       help='start directy in the given activity')
   parser.add_argument('-f', '--fullscreen', action='store_true',
                       help='start in fullscreen')
   parser.add_argument('-y', '--youtube-dl', action='store_true',
                       help='use youtube-dl to scrape and play mediaurl')
   parser.add_argument('--standalone', action='store_true',
                       help='start in X without a WM (fullscreen)')
   parser.add_argument('mediaurl', nargs='?',
                       help='local file or remote url to play')
   args = parser.parse_args()

   # setup efl logging (you also need to set EINA_LOG_LEVEL=X)
   l = logging.getLogger("efl")
   h = logging.StreamHandler()
   h.setFormatter(logging.Formatter("EFL %(levelname)s %(message)s"))
   l.addHandler(h)
   l.setLevel(logging.DEBUG)

   # tag for pulse audio... name not working here, icon yes  :/
   os.environ['PULSE_PROP_media.role'] = 'video'
   os.environ['PULSE_PROP_application.name'] = 'Emotion Media Center'
   os.environ['PULSE_PROP_application.icon_name'] = 'epymc'
   
   # init elementary
   # elementary.init()
   # elementary.need_ethumb()

   # create config/cache dirs if necessary
   if not os.path.exists(utils.user_cache_dir):
      os.makedirs(utils.user_cache_dir)
   if not os.path.exists(utils.user_conf_dir):
      os.makedirs(utils.user_conf_dir)
   try: os.mkdir(os.path.join(utils.user_conf_dir, 'plugins'))
   except OSError: pass
   try: os.mkdir(os.path.join(utils.user_conf_dir, 'themes'))
   except OSError: pass
   try: os.mkdir(os.path.join(utils.user_conf_dir, 'channels'))
   except OSError: pass
   try: os.mkdir(os.path.join(utils.user_conf_dir, 'subtitles'))
   except OSError: pass

   #TODO add a system dir...but where??
   ini.read_from_files(['epymc.conf',
                        os.path.join(utils.user_conf_dir, 'epymc.conf')])
   ini.setup_defaults()

   # init stuff
   sdb.init()
   thumbnailer.init()
   if not gui.init():
      return 1
   browser.init()
   mainmenu.init()
   config_gui.init()
   mediaplayer.init()
   storage.init()

   # load & init modules
   modules.load_all()
   modules.init_all_by_config()

   # show the mainmenu
   mainmenu.show()

   # use youtube-dl to scrape and play the url given on command line
   if args.youtube_dl and args.mediaurl:
      from epymc.youtubedl import YoutubeDL

      ytdl = YoutubeDL()

      def ytdl_url_cb(real_url):
         if not real_url:
            gui.EmcDialog(style='error',
                          text=_('youtube-dl is unable to scrape the given url'))
         else:
            print('Real video url:',real_url)
            mediaplayer.play_url(real_url)
            mediaplayer.title_set('')

      def ytdl_update_cb(success, dialog):
         if dialog: dialog.delete()
         print('Scraping url:', args.mediaurl)
         ytdl.get_real_video_url(args.mediaurl, ytdl_url_cb)

      print('Checking for ytdl updates')
      if ini.get_bool('videochannels', 'autoupdate_ytdl') == True:
         ytdl.check_update(verbose=True, done_cb=ytdl_update_cb)
      else:
         ytdl_update_cb(True, None)
      
   # if mediaurl given on command line play it (must be a video file)
   elif args.mediaurl:
      if args.mediaurl.startswith(('http://', 'https://')):
         mediaplayer.play_url(args.mediaurl)
         mediaplayer.title_set('')
      elif os.path.exists(args.mediaurl):
         mediaplayer.play_url(os.path.abspath(args.mediaurl))
         mediaplayer.title_set(os.path.basename(args.mediaurl))
   # or autostart the give activity (ex: --activity movies)
   elif args.activity:
      mainmenu.item_activate(args.activity)
   # fullscreen requested from command line
   if args.fullscreen:
      gui.fullscreen_set(True)

   # run standalone (inside X without a WM)
   if standalone or args.standalone:
      from efl import ecore_x
      ecore_x.init()
      # set fullscreen
      x, y, w, h = gui.win.screen_size
      gui.win.size = (w, h)
      # give focus to the win
      ecore_x_win = ecore_x.Window_from_xid(gui.win.xwindow_xid)
      ecore_x_win.focus()

   # alert if run from python < 3 (lots of translation issue with 2.7)
   if utils.is_py2():
      txt = '<b>PYTHON 2 IS NOT SUPPORTED ANYMORE!</b><br><br>' \
            'You are using python2, it is old!<br>' \
            'EpyMC works much better with py3, even more if you are not ' \
            'using the english language.<br><br>' \
            '<b>YOU MUST SWITCH TO PYTHON 3 !!!</b>'
      gui.EmcDialog(style='warning', text=txt)

   # run the main loop
   elementary.run()

   # shutdown
   modules.save_enabled()
   modules.shutdown_all()
   storage.shutdown()
   config_gui.shutdown()
   ini.write_to_file(os.path.join(utils.user_conf_dir, 'epymc.conf'))
   mediaplayer.shutdown()
   browser.shutdown()
   gui.shutdown()
   thumbnailer.shutdown()
   sdb.shutdown()

   print('Bye Bye...')
   return 0