Ejemplo n.º 1
0
 def _renderPaths(self, paths):
     print("paths:", paths)
     path = Path("P1", paths[0], self.model.robots[0].color)
     self.model.entities[path.name] = path
     path.createShape(self)
     path = Path("P2", paths[1], self.model.robots[1].color)
     self.model.entities[path.name] = path
     path.createShape(self)
Ejemplo n.º 2
0
    def __init__(self):
        self.path = Path()

        self.event_earning_rate_dict = {
            'kodex_200': 0,  # KODEX 200
            'kodex_us_S_and_P500': 0,  # KODEX 미국S&P500선물(H)
            'tiger_euro_50': 0,  # TIGER 유로스탁스50(합성 H)
            'kodex_japan_topix_100': 0,  # KODEX 일본TOPIX100
        }

        # NOTE: 예금 금리는 1.5 % 로 고정, 추후 필요하면 Crawler 에서 금리 긁어오도록 수정
        self.deposit_interest_rate = 1.5
Ejemplo n.º 3
0
 def generate_new_path(self, startNode):
     newPath = Path()
     self.generate_path_for_node(startNode, newPath)
     return newPath
Ejemplo n.º 4
0
 def __init__(self):
   home_path = os.path.realpath(os.path.expanduser('~'))
   self.default_dir_path = home_path
   self.current_dir_path = ""
   self.path = Path(self)
   self.is_skip_hidden_files = False
Ejemplo n.º 5
0
class JustDanceController(object):
  window = None

  def __init__(self):
    home_path = os.path.realpath(os.path.expanduser('~'))
    self.default_dir_path = home_path
    self.current_dir_path = ""
    self.path = Path(self)
    self.is_skip_hidden_files = False

  @property
  def icon_view(self):
    return self.window.paned.directory_content_scrolled_window.icon_view

  def set_window(self, window):
    self.window = window

  def list_dir(self):
    time_start = time.time()
    self.icon_view.freeze_child_notify()
    self.icon_view.set_model(None)
    try:
      self.icon_view.clear_items()
      print "Time for clear items: %s" % (time.time() - time_start)
      directory_listing = os.listdir(self.path.current_active_path)
      for filename in directory_listing:
        # Skip hidden files
        if self.is_skip_hidden_files and filename[0] == '.':
          continue
        file_path = os.path.join(self.path.current_active_path, filename)
        if os.path.isdir(file_path):
          self.icon_view.add_item(filename, Gtk.STOCK_DIRECTORY, True)
        else:
          #mime_type, encoding = mimetypes.guess_type(file_path, False)
          #if mime_type:
          #  icon = self.icon_view.get_icon_from_mime_type(mime_type)
          #  self.icon_view.add_with_icon(filename, icon, False)
          #else:
          self.icon_view.add_item(filename, Gtk.STOCK_FILE, False)
      self.window.set_number_of_files(len(directory_listing))
    except OSError as oe:
      print oe
    self.icon_view.set_model(self.icon_view.list_store_model)
    self.icon_view.thaw_child_notify()
    print "Time elapsed: %s" % (time.time() - time_start)

  def set_current_path(self, path):
    self.current_dir_path = path

  def get_current_path(self):
    return self.current_dir_path

  def open_file_in_current_directory(self, sub_path):
    file_path = self.path.get_sub_path_as_full_path(sub_path)
    os.system('/usr/bin/xdg-open %s' % file_path)

  def go_to_sub_path(self, sub_path):
    full_path = self.path.get_sub_path_as_full_path(sub_path)
    self.go_to_path(full_path)

  def go_to_path(self, path):
    time_start = time.time()
    #    TODO: verify that path is valid?
    self.path.navigate_to_path(path)
    self.list_dir()

    self.window.toolbar.set_entry_to_current_path()
    self.window.toolbar.add_button_for_each_directory()
    print "Go to path Time elapsed: %s" % (time.time() - time_start)
Ejemplo n.º 6
0
    def dtreePathGeneration(self):
        dtreePaths = Paths()

        newPath = Path()
        newPath.addNode(self.dtree.getNode(1))
        newPath.addNode(self.dtree.getNode(2))
        newPath.addNode(self.dtree.getNode(3))
        dtreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.dtree.getNode(1))
        newPath.addNode(self.dtree.getNode(2))
        newPath.addNode(self.dtree.getNode(8))
        dtreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.dtree.getNode(1))
        newPath.addNode(self.dtree.getNode(2))
        newPath.addNode(self.dtree.getNode(4))
        newPath.addNode(self.dtree.getNode(5))
        dtreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.dtree.getNode(1))
        newPath.addNode(self.dtree.getNode(2))
        newPath.addNode(self.dtree.getNode(3))
        newPath.addNode(self.dtree.getNode(4))
        newPath.addNode(self.dtree.getNode(6))
        newPath.addNode(self.dtree.getNode(7))
        dtreePaths.addPath(newPath)

        return dtreePaths
Ejemplo n.º 7
0
    def decisionTreePathGeneration(self):
        decisionTreePaths = Paths()

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(15))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        newPath.addNode(self.decisionTree.getNode(4))
        newPath.addNode(self.decisionTree.getNode(5))
        newPath.addNode(self.decisionTree.getNode(6))
        newPath.addNode(self.decisionTree.getNode(7))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        newPath.addNode(self.decisionTree.getNode(4))
        newPath.addNode(self.decisionTree.getNode(5))
        newPath.addNode(self.decisionTree.getNode(6))
        newPath.addNode(self.decisionTree.getNode(14))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        newPath.addNode(self.decisionTree.getNode(4))
        newPath.addNode(self.decisionTree.getNode(5))
        newPath.addNode(self.decisionTree.getNode(6))
        newPath.addNode(self.decisionTree.getNode(8))
        newPath.addNode(self.decisionTree.getNode(9))
        newPath.addNode(self.decisionTree.getNode(10))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        newPath.addNode(self.decisionTree.getNode(4))
        newPath.addNode(self.decisionTree.getNode(5))
        newPath.addNode(self.decisionTree.getNode(6))
        newPath.addNode(self.decisionTree.getNode(8))
        newPath.addNode(self.decisionTree.getNode(9))
        newPath.addNode(self.decisionTree.getNode(13))
        decisionTreePaths.addPath(newPath)

        newPath = Path()
        newPath.addNode(self.decisionTree.getNode(1))
        newPath.addNode(self.decisionTree.getNode(2))
        newPath.addNode(self.decisionTree.getNode(3))
        newPath.addNode(self.decisionTree.getNode(4))
        newPath.addNode(self.decisionTree.getNode(5))
        newPath.addNode(self.decisionTree.getNode(6))
        newPath.addNode(self.decisionTree.getNode(8))
        newPath.addNode(self.decisionTree.getNode(9))
        newPath.addNode(self.decisionTree.getNode(11))
        newPath.addNode(self.decisionTree.getNode(12))
        decisionTreePaths.addPath(newPath)

        return decisionTreePaths
Ejemplo n.º 8
0
 def add_paths(self, path_list):
     paths = [Path(node_a, node_b) for node_a, node_b in path_list]
     self._paths.extend(paths)
     return paths